Is Unity doing any kind of optimization if no Update function is declared in the behavior? Like, does it use reflection to build an “updatable components” list, or does it try to call it on all components anyway?
I’m asking because we have a base class that declares the standard Awake/Start/Update etc as virtual, just so we can use override in Visual Studio, and never forget to call base etc… and I’m wondering if there is a side-effect to that.
Have you tried fooling Visual Studio with this?
#if UNITY_EDITOR
void Update () {
}
#endif
I would venture to guess that Unity builds a list of Awake/Start/Update methods/functions to call based on those that actually exist. There is nothing to be gained by creating virtual stubs that contain no code.
I worked on a project where we had noticeable performance improvements by removing a bunch of empty Update functions, so you don’t want an Update function if it isn’t going to do anything.