Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: breakmachine on February 14, 2014, 08:46:15 AM

Title: nullreference in UIDrawCall
Post by: breakmachine on February 14, 2014, 08:46:15 AM
I got a crash report from a tester that points to a null reference error in UIDrawCall.ClearAll(). Maybe you could put a if dc!=null or dc.gameobject!=null statement there?

02-14 13:56:36.859: I/Unity(8856): NullReferenceException
02-14 13:56:36.859: I/Unity(8856):   at UnityEngine.Component.get_gameObject () [0x00000] in <filename unknown>:0
02-14 13:56:36.859: I/Unity(8856):   at UIDrawCall.ClearAll () [0x0002c] in C:\Users\Public\Documents\Unity Projects\WordMonsters\Assets\NGUI\Scripts\Internal\UIDrawCall.cs:664
02-14 13:56:36.859: I/Unity(8856):   at UIDrawCall.ReleaseAll () [0x00000] in C:\Users\Public\Documents\Unity Projects\WordMonsters\Assets\NGUI\Scripts\Internal\UIDrawCall.cs:676
02-14 13:56:36.859: I/Unity(8856):   at UIPanel.OnDisable () [0x00062] in C:\Users\Public\Documents\Unity Projects\WordMonsters\Assets\NGUI\Scripts\UI\UIPanel.cs:728
Title: Re: nullreference in UIDrawCall
Post by: ArenMook on February 15, 2014, 01:01:16 AM
It's already there.
  1.         static public void ClearAll ()
  2.         {
  3.                 bool playing = Application.isPlaying;
  4.  
  5.                 for (int i = mActiveList.size; i > 0; )
  6.                 {
  7.                         UIDrawCall dc = mActiveList[--i];
  8.  
  9.                         if (dc)
  10.                         {
  11.                                 if (playing) NGUITools.SetActive(dc.gameObject, false);
  12.                                 else NGUITools.DestroyImmediate(dc.gameObject);
  13.                         }
  14.                 }
  15.                 mActiveList.Clear();
  16.         }