Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Jonu on January 22, 2014, 06:34:45 AM

Title: Bug in 3.0.9 f 3
Post by: Jonu on January 22, 2014, 06:34:45 AM
Application is crashing when you are closing it on IOS and Android devices.

This is the error:

NullReferenceException
at UnityEngine.Component.get_gameObject () [0x00000] in <filename unknown>:0
at UIDrawCall.ClearAll () [0x00000] in <filename unknown>:0
at UIDrawCall.ReleaseAll () [0x00000] in <filename unknown>:0
at UIPanel.OnDisable () [0x00000] in <filename unknown>:0



Title: Re: Bug in 3.0.9 f 3
Post by: Redd on January 22, 2014, 02:38:34 PM
I have the same bug, please add a null object check.
Title: Re: Bug in 3.0.9 f 3
Post by: ArenMook on January 22, 2014, 09:27:56 PM
Did you try it in f4?
Title: Re: Bug in 3.0.9 f 3
Post by: Jonu on January 23, 2014, 06:13:09 AM
Did you try it in f4?

I tried that and it is still crashing.
Title: Re: Bug in 3.0.9 f 3
Post by: ArenMook on January 23, 2014, 06:14:49 AM
Try changing UIDrawCall.ClearAll and ReleaseAll to these:
  1.         /// <summary>
  2.         /// Clear all draw calls.
  3.         /// </summary>
  4.  
  5.         static public void ClearAll ()
  6.         {
  7.                 bool playing = Application.isPlaying;
  8.  
  9.                 for (int i = mActiveList.size; i > 0; )
  10.                 {
  11.                         UIDrawCall dc = mActiveList[--i];
  12.  
  13.                         if (dc)
  14.                         {
  15.                                 if (playing) NGUITools.SetActive(dc.gameObject, false);
  16.                                 else NGUITools.DestroyImmediate(dc.gameObject);
  17.                         }
  18.                 }
  19.                 mActiveList.Clear();
  20.         }
  21.  
  22.         /// <summary>
  23.         /// Immediately destroy all draw calls.
  24.         /// </summary>
  25.  
  26.         static public void ReleaseAll ()
  27.         {
  28.                 ClearAll();
  29.  
  30.                 for (int i = mInactiveList.size; i > 0; )
  31.                 {
  32.                         UIDrawCall dc = mInactiveList[--i];
  33.                         if (dc) NGUITools.DestroyImmediate(dc.gameObject);
  34.                 }
  35.                 mInactiveList.Clear();
  36.         }
Title: Re: Bug in 3.0.9 f 3
Post by: Jonu on January 23, 2014, 06:27:09 AM
It started worked with this code change
Title: Re: Bug in 3.0.9 f 3
Post by: ArenMook on January 23, 2014, 06:28:21 AM
Perfect, thanks. I'll add it in the next update.