Terrible performance spikes (~1500ms), EventSystem.Update()

So, I’m getting some really awful performance spikes, and having a tough time determining where the latency is coming from; the profiler isn’t giving me many details as to what is chewing up CPU.

Maybe I’m missing something?

From what I can see, we aren’t doing any substantial allocation, and “EventSystem.Update()” listing object “N/A” doesn’t really help me break anything down. Thoughts?

Thanks,
-M

have you tried to make a “Depp Profile” ? You will see more detailed profiler logs.
there is a button in your profiler where you can set this option on.

in this one frame you are deactivatin over 4000 Gameobjects :open_mouth:

Also your Debug Logs are causing some Garbage

I am just guessing: given the massive amount of Gameobject.Deactivate calls you’re probably doing something on activate/deactivate of the gameobjects causing the allocation of memory from the heap? Like in Start() or Awake() of scripts that are attached to the gameobjects?

The 4000 deactivates are probably a decent clue. What are these objects being deactivated? And can you avoid it or spread the cost across multiple frames?