Handy Unity fact of the day
So, today's useful snippet, after too long debugging a related issue: if you have an Awake()
method on a MonoBehaviour
in Unity, and that method throws an exception that isn't handled, the component in question will be automatically disabled. on startup.
It turns out that tracking down why something has been disabled or enabled in Unity is quite tricky - even if you add the OnDisable()
method to the component, there's no callstack or passed-in information that lets you work out what happened.