Hi, I have updated NGUI from 3.6.0 to 3.9.4 in a project I am working and today I ended up with a NullReferenceException in Android platform, where the UI2DSprite was not being rendered in the device, but in Unity Editor the NullReferenceException does not happen.
So, I have reverted the modifications inner "UIDrawCall.Create(string name)" method and the problem was fixed.
Fix in UIDrawCall.cs (v3.9.4), line 714: if (mInactiveList.size > 0)
{
UIDrawCall dc = mInactiveList.Pop();
if (dc!=null && dc.gameObject != null) // -> this line is present in version 3.6.0
{
mActiveList.Add(dc);
if (name != null) dc.name = name;
NGUITools.SetActive(dc.gameObject, true);
return dc;
}
}
This is what I got from adb logcat:I/Unity ( 5425): NullReferenceException
I/Unity ( 5425): at UIDrawCall.Create (System.String name) [0x00033] in C:\Users\...\Assets\Third Parties\NGUI\Scripts\Internal\UIDrawCall.cs:778
I/Unity ( 5425): at UIDrawCall.Create (System.String name, .UIPanel pan, UnityEngine.Material mat, UnityEngine.Texture tex, UnityEngine.Shader shader) [0x00000] in C:\Users\...\Assets\Third Parties\NGUI\Scripts\Internal\UIDrawCall.cs:753
I/Unity ( 5425): at UIDrawCall.Create (.UIPanel panel, UnityEngine.Material mat, UnityEngine.Texture tex, UnityEngine.Shader shader) [0x00000] in C:\Users\...\Assets\Third Parties\NGUI\Scripts\Internal\UIDrawCall.cs:743
I/Unity ( 5425): at UIPanel.FillAllDrawCalls () [0x0014e] in C:\Users\...\Assets\NGUI\Scripts\UI\UIPanel.cs:1248