- Home /
What is the signature of Awake() and Start()
I was wondering, how is it possible for me to simply override the Awake and Start (and the rest of the overridable functions in MonoBehaviour) by only using void Awake()
as opposed to public override void Awake()
I am assuming (and this is probably where I am wrong) that Awake and Start are marked as virtual in MonoBehaviour, and if that's the case, I should be required to use the override
keyword when overriding them in my MonoBehaviour subclass.
Does anyone know how is this made possible?
Answer by Bunny83 · Jun 05, 2013 at 10:10 AM
Those methods aren't even part of the MonoBehaviour class ;) Unity uses reflection to call those callbacks if they exist. Keep in mind that those callbacks are invoked from native C++ code, so they have to use reflection delegates anyway.
If you want to create a "base class" that inherits from MonoBehaviour, just declare Start / Awake / Update as virtual and override it in a sub class. Keep in mind that virtual methods are a little bit slower due to the lookup table.
Oh. Interesting.
Yes, I know how to override these in a subclass, but was wondering how I am not required to use override
in the class that inherits directly from $$anonymous$$onoBehaviour.
Thanks for clarifying.
Your answer
![](https://koobas.hobune.stream/wayback/20220613103548im_/https://answers.unity.com/themes/thub/images/avi.jpg)