(back to blog)

On Unity's Gfx.WaitForPresent Problem


In many Unity projects I've worked on, I've encountered those green spikes seen in the profiler, under the name Gfx.WaitForPresent, which chops framerate down to hell. This basically means that CPU's waiting time for GPU to finish its job, in other words, that spike you see is not the problem itself. I guess it probably indicates that some rendering.. thing.. is horribly conflicting with another, and my googling failed to give me a definite answer of reason why. I'll mention some options to try, mostly compiled from here, for not having to look at the same inconclusive forum threads again and again. Some of them doesn't make any sense initially, or may be fixed in time, but lack of definite solutions made me keeping them here anyway:

Note that this post is about "spikes", which indicates not necessarily a GPU bound situation. If your profiler have somewhat steady amount of Gfx.WaitForPresent, your game may be suffering from some heavy rendering tasks.

If you too have had the same issue and solved it, I'd love to hear from you.