My game is a bullet heaven game. So I have dozens of enemies spawning and moving towards the player. I have weird stuttering, but it doesn’t appear to be based off number of enemies. So I am currently trying to debug, but my when the stutters happen, the debugger isn’t showing anything.
It’s showing the PlayerLoop has spiked in the category “Other”, but there’s no details on what’s consuming the resources.
When looking at the GPU at the same time, I see the exact same spike and a “PostLateUpdate.PresentAfterDraw”, which if I look for errors revolving around that, I see articles that are ~9 years old, but describe the same thing I’m experiencing, but the fixes they suggest either: don’t work or are for such an old editor that it’s no longer present.
I’m using Unity 2022.3.16f
Things I know are not causing it:
GC - I’ve disabled auto GC and am manually triggering it.
URP/HRP - I’ve completely removed both and it’s still occurring.
After completely gutting everything, I’ve identified it.
It was one of the flags on the Camera in scene.
For whatever reason if you leave the flag enabled for HRD Rendering and/or(I didn’t spend too much time after the stuttering stopped) MSAA to using the rendering settings, it causes the GPU to wait for some reason, causing the stutter.
By setting the options to “Disable” for both HRD Rendering and MSAA I don’t have any issues with the stuttering.
This is a solution for my 2d game (please note, I didn’t touch the settings in the Project settings so maybe that is a fix as well).
My computer is about as overbuilt as you can make it (64gb memory, 4090 gpu, 12 core processor). Nothing is anywhere near resource max and nothing else running is consuming significant resources. I don’t have any RGB managers on my machine (which was the identified issue in the linked article).
Further, the second I toggle those settings the issue comes back immediately.
If you’d like to pursue this further, you can record an ETW trace (like I asked the other person in that other thread) and I will look at it and confirm/deny that it’s what is causing it. If you prefer, you can also report a bug with your project so we could investigate those options.