Like many pieces of closed-source software, the inner workings of Unity Engine can be a mystery sometimes. Luckily, some answers can be fished out by some well placed Debug.Log calls.
A few months ago, I wanted to find out the order in which methods get called when you call AddComponent. Sometimes you need to instantiate components that instantiate their components and you don’t have a chance to initialize its fields.
More to the point: It turns out that by the time AddComponent returns, that new Component's Awake will have been already called. Check out the screenshots above.
Unity Boston (2015) featured a talk on Unity's feature/development roadmap. And more than what's outlined on their page for it, it sounds like they have plans for a new scripting component base class (essentially "a new MonoBehaviour" which fixes and improves upon what they learned from their "design mistakes from 10 years ago" when they first made the architectural decisions behind MonoBehaviour, like magic methods and lifetime callback order.) I don't expect to see this for another couple of years but it's nice to see a bright API future ahead of us.













