- Home /
How does Unity call Update() etc without override or reflection?
While learning about Unity, I have some issues with how Unity works with C#. In the daytime, I'm a usual software developer, so I'm trying to really understand what Unity is doing in the backend. I'm scratching my head to understand how Unity deals with calling a custom defined Update, even though we aren't overriding it, and I read somewhere Unity doesn't use reflection (for which I'm glad, since this would slow things down).
My guess: is it because Unity doesn't actually compile the C# as is, but does some pre-processing allowing to apply some custom magic to specific cases like Update functions it discovers etc? Since mono is involved, everything is eventually compiled to IL and ran inside a CLR/Mono environment, or isn't this the case at all?
Thanks for clearing things up a bit. I know I probably shouldn't be concerned with all this, but if there's a simple explanation I'd be glad to hear it.
Answer by tanoshimi · Oct 19, 2014 at 02:37 PM
Does this answer your question? http://answers.unity3d.com/questions/177245/how-does-unitys-built-in-event-system-work-behind.html
Answer by Bart5 · Oct 19, 2014 at 07:53 PM
So long story short, reflection IS being used and there's no magic at all :-( Thanks!