We're in the middle of debugging an issue here that I think is related to unloading some bundles, which has exposed some NullReferenceExceptions in BetterList.Contains and UIPanel.GetDrawCall:
NullReferenceException: Object reference not set to an instance of an object
at BetterList`1[UnityEngine.Material].Contains (UnityEngine.Material item) [0x00000] in <filename unknown>:0
at UIPanel.UpdateTransforms () [0x00000] in <filename unknown>:0
at UIPanel.LateUpdate () [0x00000] in <filename unknown>:0
NullReferenceException: Object reference not set to an instance of an object
at UIPanel.GetDrawCall (UnityEngine.Material mat, Boolean createIfMissing) [0x00000] in <filename unknown>:0
at UIPanel.Fill (UnityEngine.Material mat) [0x00000] in <filename unknown>:0
at UIPanel.LateUpdate () [0x00000] in <filename unknown>:0
The BetterList error should be easy to fix:
for (int i = 0; i < size; ++i) if (buffer[i] != null && buffer[i].Equals(item)) return true;
instead of
for (int i = 0; i < size; ++i) if (buffer[i].Equals(item)) return true;
Unfortunately no line numbers are available in the builds we've seen this in, but I think a null material is sneaking in somewhere when we unload some bundles containing our UI, so UIPanel.GetDrawCall is probably failing on:
GameObject go
= new GameObject
("_UIDrawCall [" + mat
.name + "]");
Whether or not that should be fixed, or how best to fix it without a reliable repro, I'll leave up to you. That specific error is easy enough to guard against, but if UIDrawCall instances are left hanging around with null materials, that's obviously a bad state that we shouldn't be letting NGUI get into. We're working on fixing the source of the problem in our code, but I figured these were worth pointing out in case you wanted to deal with them.