This may be a Unity bug, but I thought I should post it here since I'm finding it while working on a custom NGUI class.
A problem is arising after the object is destroyed. OnDestroy() is called, and then another UpdateAnchors()
I cannot use a flag in OnDestroy, because after the OnDestroy is called, all the values for the object are reset.
Here's a simple class to test this.
public class testCallOrder : MonoBehaviour
{
void Awake()
{
Debug.Log("Awake");
}
void Start()
{
Debug.Log("Start");
}
void OnDestroy()
{
Debug.Log("OnDestroy");
}
public void UpdateAnchors()
{
Debug.Log("UpdateAnchors");
}
}
Put this in a NGUI sprite, run the game. Expand the game window to maximum, then quit the game.