Author Topic: [FIX] UI2DSprite (v3.9.4) shows up in Editor but not in Android device  (Read 1986 times)

sandolkakos

  • Newbie
  • *
  • Thank You
  • -Given: 16
  • -Receive: 1
  • Posts: 17
    • View Profile
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:
  1.                 if (mInactiveList.size > 0)
  2.                 {
  3.                         UIDrawCall dc = mInactiveList.Pop();
  4.                         if (dc!=null && dc.gameObject != null) // -> this line is present in version 3.6.0
  5.                         {
  6.                                 mActiveList.Add(dc);
  7.  
  8.                                 if (name != null) dc.name = name;
  9.                                 NGUITools.SetActive(dc.gameObject, true);
  10.                                 return dc;
  11.                         }
  12.                 }
  13.  

This is what I got from adb logcat:
  1. I/Unity   ( 5425): NullReferenceException
  2. I/Unity   ( 5425):   at UIDrawCall.Create (System.String name) [0x00033] in C:\Users\...\Assets\Third Parties\NGUI\Scripts\Internal\UIDrawCall.cs:778
  3. 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
  4. 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
  5. I/Unity   ( 5425):   at UIPanel.FillAllDrawCalls () [0x0014e] in C:\Users\...\Assets\NGUI\Scripts\UI\UIPanel.cs:1248
« Last Edit: December 04, 2015, 08:00:28 AM by sandolkakos »