I got null reference on app termination i UIPanle and had to make the following fix
The fix is to check for "dc!=null" in ClearAll, ReleaseAll, Destroy:
static public void ClearAll ()
{
bool playing = Application.isPlaying;
for (int i = mActiveList.size; i > 0; )
{
UIDrawCall dc = mActiveList[--i];
if( dc!=null ){
if (playing) NGUITools.SetActive(dc.gameObject, false);
else NGUITools.DestroyImmediate(dc.gameObject);
}
}
mActiveList.Clear();
}
static public void ReleaseAll ()
{
ClearAll();
for (int i = mInactiveList.size; i > 0; )
{
UIDrawCall dc = mInactiveList[--i];
if( dc!=null )
NGUITools.DestroyImmediate(dc.gameObject);
}
mInactiveList.Clear();
}
static public void Destroy (UIDrawCall dc)
{
if (Application.isPlaying && dc!=null )
{
if (mActiveList.Remove(dc))
{
NGUITools.SetActive(dc.gameObject, false);
mInactiveList.Add(dc);
}
}
else if( dc!=null )
{
mActiveList.Remove(dc);
NGUITools.DestroyImmediate(dc.gameObject);
}
}