1
矿,这在程序员也已经陷入了一些很奇怪的东西的一个朋友......我真的不能解释它,因为这个代码:Unity3D调试魔术般地移除NullReferenceException?
try {
result = chunks.Find (delegate(float[] fa2) {
// Debug.Log("fa2: " + fa2);
// Debug.Log("fa: " + fa);
return fa2[0] == fa[0] && fa2[1] == fa[1] && fa2[2] == fa[2];
});
}
catch (Exception e) {
Debug.LogError("result1: " + e);
}
返回
result1: System.NullReferenceException: Object reference not set to an instance of an object
at March+<BuildLand>c__AnonStorey0.<>m__3 (System.Single[] fa2) [0x00009] in C:\Users\Roy\Documents\March\Assets\Scripts\March.cs:262
at System.Collections.Generic.List`1[System.Single[]].GetIndex (Int32 startIndex, Int32 count, System.Predicate`1 match) [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[System.Single[]].Find (System.Predicate`1 match) [0x00000] in <filename unknown>:0
at March.BuildLand() [0x0012c] in C:\Users\Roy\Documents\March\Assets\Scripts\March.cs:257
但是,如果您取消注释调试行,它的工作原理。 任何人都可以澄清这一点吗?谢谢你的帮助!
您是否在www.answers.unity3d.com上提问过此问题?那里可能更多关注。 – 2012-04-22 15:12:46
我想我会那么做,我认为将它放在SO中可能会更容易,因为它在C#中,Unity与此无关。 – 2012-04-22 17:53:31
我知道与团结的问题,我仍然恨这一统一。什么是“chunks.Find”? – 2013-04-03 23:56:20