How the Unity Update(), OnEnable(), etc. methods are called?

Is there someone that is able to explain in simple words how these functions are called?
I guess is somthing like this:

  • Unity collects all Monobehaviour class and sort them depending of the execution order in a list.
  • Then at each frame Unity calls Update() function on them. But Update() method is not public, and it isn’t an override function, so…

how exactly is this performed? Does Unity use some sort of Reflection system?
Thank you!

Yes. I can’t really find a good source to confirm that, but here is this:
https://stackoverflow.com/questions/32537997/why-are-the-monobehaviour-methods-not-implemented-for-overriding

Here’s another good answer about it, confirming that it is not System.Reflection being used (as I imagine that would be very slow):

1 Like