Multiple Update() calls or centralized system?

I have been looking around to get some clarification on the matter, but still I don’t understand what would work better with my case.

I have been doing some debugging and performance checks on my game and noticed on the profiler a large amount of Update calls, so I tried to make a centralized system where at runtime each of the same component get assigned to a list in a central manager component, and Update gets called there looping trough the list and calling the methods I need to be in Update.

       void Update ()
       {
           if(_renderers.Count > 0)
           {
               for(int i = 0; i < _renderers.Count; ++i)
               {
                   _renderers [i].PlayAnimation ();
                   _renderers [i].BillboardSprite();
               }
           }
       }

I used Stopwatch to check how much time this operation takes and it gets to 2ms when I git around 250 renderers (Note that renderers are a custom component of mine to control sprite behaviour, isn’t really a Renderer of UnityEngine).

The profiler says:
Total = 3.7%
Self = 3.7%
Calls = 1
GC = 0
Time ms = 0.53
Self ms = 0.53

On task manager CPU usage is around 08, rarely spikes to 11.

It seems all fine, but consider the objects present in the map so far are just static pickups items, is just normals sprites with a custom animation system and a billboard operation to face the camera. Doing with separate calls for each renderer I get slightly better results, almost half the cost except CPU usage which is always around the same.

My question is, should I stick on a centralized system or keep Update calls on their own object? THe performance gain and loss for both methods seems almost non existant and I’m a bit worried that on the long run may cause problems, since I may have on screen more than 250 sprites doing their own thing.

Should I maybe ditch Update completly and go with coroutines for such a case?

Thanks

Always find this article of interest. Scroll down a bit to the 10000 update call section where it talks about the manager vs calling update on each.

1 Like

I watched the GDC talk about the Inside developers and they said Update and FixedUpdate is bad and that they run their own updatemanager.