I’m having a problem in builds where every few seconds I get a giant spike in performance, going from a frame time of 3ms in the frame before, to >1000ms and then back down to 3ms. This is happening all of the time, even when just standing still. When looking in the profiler, each time the spike shows as coming from something completely random each time, even coming from things such as lighting when my project uses no unity lights and everything is on unlit shaders.
I was previously on Unity version 2022.2.11f and upgraded to the LTS version 2022.3.13f to see if this would solve the problem, but its still occurs. Deep profiler also shows nothing different, however the spikes do occur more frequently and consistently, although they still show as coming from something completely random every time.
Here are some screen grabs of the profiler attached to a dev build.
I really don’t know how to proceed here, these spikes are extremely annoying and noticeable in gameplay. Any help or advice on how to track down the cause would be appreciated.
Alternatively, there might be GC.Collect work going on on a different thread while main thread freezes in random places. Check Timeline view to determine if that might be it.
Since that version isn’t out I figured I’d try the 2023.2.0f1 release and the issue still occurs in that version, so unfortunately it looks like the issue isn’t connected to that one.
Okay, further testing and it looks like the spikes were being caused by having the realtime GI checkbox on in the lighting settings, unchecking that box removes those threads and things seem to be running a lot smoother now No idea why that setting was enabled.
The semaphores probably waited on the Worker threads sorting the Render Loop? That or they spawned a whole bunch of Native Jobs without Profiler Markers that stole the cores out from underneath all other threads. There should have definitely been more idle samples there, at least on Worker 1.