Gfx.WaitForPresent performance issue

I am making a mobile game and it runs really well (60 fps) on my phone. However, in some cases the performance goes down drastically to the point where it runs at 20 fps or even less. It happens at random times so I can’t pinpoint what is causing this. During the performance decrease Gfx.WaitForPresent appears in my profiler which eats a lot of power. I am aware that this might be because of Vsync being turned on, but I have it disabled, along with shadows, AA and everything else that absolutely kills mobile performance. What else can be the problem? My game relies heavily on good performance for gameplay so this needs to be resolved ASAP.

Edit: I also noticed that the CPU stays at 0 ms which is really odd as well.

It’s always unclear if you look only at CPU stats, and claim that Gfx.WaitForPresent is making the cause of your problem.

I’m also still don’t understand why that happening, but as you can see in the Rendering and Memory Profiler, there’s a Dramatic Increase in your Batches, Draw calls, that resulted by an increase of object count in your scene. That is the actual reason why it’s spikes up.

Perhaps, maybe you want to take a look at each of your scripts whether there’s something that creates a bulk of GameObject in your game, or turn on that ‘Deep Profiler’, in case, you can track which script in your project uses a lot of resources.

Try disabling Metal if you are on MacOS.

Project settings > Player > Other settings > Rendering > Auto Graphics API For Mac (uncheck)

Then drag OpenGLCore above Metal in the list.