Gfx.waitForPresent causing massive lag spikes in editor

Something is causing the editor to get unusably low framerates in the editor. Using the profiler, I can see that Gfx.waitForPresent is spinning for around 100ms at each lag spike. Now, I’ve been around Unity for a while now, and I know that Gfx.waitForPresent is VSync, but no matter what the target framerate is, it should never have to wait 100ms between frames. Here’s a screenshot of the profiler on an empty scene in a new project when I just try to move the editor camera around:

This is a brand new system, here are the specs if that might help shed some light:

  • i7-6700k
  • GTX 980Ti
  • 16GB RAM
  • NvMe PCIe SSD
  • G-Sync monitor (2560x1440@165Hz)

I have already tried changing pretty much every VSync/G-Sync related setting I could find. Any ideas would be appreciated

Turning off NVIDIA IN-GAME OVERLAY seemed to work for me. 105239-in-game-overlay.png

I found a solution for my computer. If you have a laptop with an NVIDIA GPU, check if the problem only happens when you have the AC unplugged. If so, open Geforce Experience and go to Settings > Games. There’s a setting called “Battery Boost”, turn that off completely or move the FPS setting within it up to 60 FPS.

105150-2017-11-06-17-40-24-geforce-experience.png

Try Edit → Project Settings → Quality and V Sync Count to Don’t Sync.

Gfx.waitForPresent is like the CPU is waiting till the rendering process is finished.

If the problem still exist u should check ur renderprocess in the profiler wich takes much time.

I believe I have found the solution; it worked on my project at least! This “Gfx.WaitForPresent” was being caused by a tiny checkbox in the “Player” settings. Uncheck “Graphics Jobs (Experimental)” and you should see that “Gfx.WaitForPresent” has either been completely removed or at least greatly reduced.

I have the same GPU and probably the same monitor as you and I had this exact issue. For me the fix was turning off G-SYNC in the NVIDIA control panel.

I don’t have Graphics Jobs (Experimental) checked, yet still see 63% Gfx.WaitForPresent. I also don’t even have a GPU. See attached. Any ideas?alt text

I was able to fix mine by closing EVGA Precision XOC

If you are on MacOS disabling Metal might help with this. My Mac mini with integrated graphics was chugging along on simple scenes between 45-60fps. After disabling Metal my FPS is in the hundreds!

Project settings > Player > Other settings > Rendering > Auto Graphics API For Mac (uncheck)
Then drag OpenGLCore above Metal in the list.