gfx.waitforPresent strikes again...I guess.

So I am making a simple RTS for mobile - it is in 3D - and my code is well optimized but I always see in my profiler that it lags because of gfx.waitforPresent. I did some research and about its thread but and i concluded that I can’t really do something about it? Am I right about this?
If I am, should I move the project and assetws to 2D now, as this may reduces its effect?
I am aiming for high troop number in the battle scene, what should be done here?

Basically GFX.WaitForPresent is the period of time that the graphics card is waiting for the vertical refresh (also known as “Vsync”) to take place. This normally occurs every 16.6ms (though it depends on the monitor the user has). If the entire game is able to run in a period of 5ms, you still have to wait for the remaining 11.6ms that it takes for the display to be ready for another refresh.

If you need more details there is a comment on the Oculus forums with a more detailed explanation.

https://forums.oculus.com/developer/discussion/comment/260638/#Comment_260638

Absolutely nothing. The more complex your game becomes, the lower the number will be in the profiler. Just treat it the same as you treat the “System Idle Process” in Windows. It’s simply another way to see how idle the CPU is.

From what I read, it means the CPU is waiting for the GPU. Check the GPU stats.

Edit : Welp, treacherous forums didn’t tell me someone answered before me!

Here is a quote from UT staff to the question what “Gfx.WaitForPresent” means. It’s copied from https://forum.unity3d.com/threads/gfx-waitforpresent.211166/page-2#post-1726966

1 Like

It’s only waiting for the renderer to catch up if you’re getting less than 60Hz (or whichever refresh rate your monitor is). The comment from the Oculus forum touches on that aspect. My understanding of the OP was that they hadn’t reached that point yet.

Just so you’re aware, you can “turn it off” by turning off VSync. You can turn off VSync in the quality settings for your project. Also keep in mind however that you may have other software running on your PC (such as RivaTuner) which limits applications to 60 FPS.

As long as VSync is unlocked, you won’t see that element in the profiler, and in the “stats” for a running game you’ll see frames per second higher than 60 (likely in the hundreds, maybe thousands).

He wrote he is targeting mobile. I’m not aware that you can turn off v-sync on mobile.

Thank you for your replies.

So changing the models to animated 2D sprites won’t add much?

Ah, didn’t see that. My bad.

It may, but basically it’s not something you need to worry about. It’s already been said but “waitforPresent” basically means the game’s already running as fast as it can on your current hardware (simplifying a bit).

You can look at all of the other things in the profiler, and take note of if they decrease in their amount of time (shown as ms, milliseconds) when you make the change, but it’s not really something you need to worry about until the gfx.waitforPresent amount is getting pretty low.