Performance of Update() vs Delegate.Invoke()

Hi,

I’m looking to replace having different Update calls spread out by centralizing these calls to a game manager. The reason for this approach is that I want to control which methods are called in different game states.

So instead of having this in several scripts:

    void Update()
    {
        if(GameManager.State == GameState.Running)
            // do stuff
    }

I have this in the game manager:

    void Update()
    {
        if(State == GameState.Running)
            foreach(Action method in methodsToCall)
                method.Invoke();
    }

This is working as expected. However, one interesting finding when scaling this up a lot (say 1000+ calls), is that the performance of my approach is way below the performance of having separate Update calls (total time reported by the profiler). What I’m curious about is why that is? Or more basic, does anyone know how the calls to each Update method in Unity is done internally to be that fast? I noticed that having an array of method delegates is faster than having a list (as expected), but still it can’t compare to Unity’s way of calling the Update methods.

Any insight much appreciated!

look interessing question