I know there have been a hundred posts about this issue, but I’m yet to see an explanation or solution that actually applies. I had to format my computer and reinstall Unity, and now this issue is present. I can’t create a project to reproduce it reliably on other computers, because it is editor related, not project.
Prior to the reinstall, the game was running smoothly in the editor. In addition, this issue is also present in blank scenes. As in, I can’t maintain 60fps in blank scenes. Builds run perfectly.
I tried upgrading from 2017.1 to 2017.2, but the issue still remains.
I added my GPU to the profiler, and Camera.Render at its peak is taking 0.047ms. Where Gfx.WaitForPresent is taking 27.44ms. These numbers are taken from a blank scene, but scenes with objects in them have similar values.
As mentioned, I can’t find an explanation or solution for this issue, and it’s extremely annoying trying to test my game at ~25fps.
Did you check if Editor uses not internal GPU?
Do you have VSync in settings? What happens if you close Scene View?
Gfx.WaitForPresent is usually indicator that vsync is on or game is gpu-bound. Assuming that this happens for an empty scene, more likely the reason is that editor uses integrated gpu.
Hi there! Thanks for the response. How do I figure out if Unity is using integrated graphics or not? I’m fairly certain my desktop PC doesn’t even have integrated graphics, so that seems unlikely. Closing the scene few gave me ~5 extra frames or so. (Going from ~25 up to ~30.) Disabling VSync didn’t have any impact.
You can check e.g. Editor.log. It contains lines like:
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.0]
Renderer: NVIDIA GeForce GT 750M (ID=0xfe9)
Vendor:
VRAM: 2018 MB
Driver: 22.21.13.8205
In this case it is dedicated GPU - GeForce GT 750M.
If you are on Windows and have NVIDIA GPU, you can enforce dedicated GPU card in "NVIDIA Control Panel->Manage 3D Settings->Program Settings tab->Select Unity.exe->Select to use High Performance Processor. Overwise please post your configuration.
Could you please, please, please rename Gfx.WaitForPresent in the profiler? There keeps popping up threads about this, and a lot of them are filled with arbitrary speculation. You can’t really google to figure out what it is, because you just hit forum/reddit threads with people giving different pieces of (not necessarily correct) advice
If the entry simply said “waiting for GPU” or “Waiting for VSync” depending on what’s happening, that’d be a great bit of help for the end users.
When deep profile is disabled, I am getting ridiculous GFX.WaitForPresent.
Now when I switch to “deep profile”, then GFX.WaitForPresent is no longer displayed in the profile.
Instead, now Camera.Render will contain additional entries such as “Render transparent geometry”.
(I am running on AMD Radeon R7 260x, which is one of the most common graphics card on the market).
The conclusion is GFX.WaitForPresent represents an amalgamation of activities. Need to switch to deep profile to find out what those activities are. Baste is right, GFX.WaitForPresent is too vague to know what it is.
.
Since GFX.WaitForPresent represents waiting for the graphics card, it won’t show up as something else if you turn on deep profiling - turning it on won’t show GPU frames in the CPU profiler.
What’s probably happening (educated guess) is that on the left, you’re waiting for the GPU at frequent intervals. On the right, the overhead of deep profiling is so large that you never need to wait for the GPU - the spikes only put you down to 60FPS when you’re waiting, and the deep profiler causes you to always run at 60FPS:
You should make sure vsync is turned off, and then turn on the GPU profiler just under it. Note that when you turn it on, it will show “your GPU doesn’t support GPU profiling” - that’s a bug. You just have to let it record frames before it understands the difference between “no frames” and “not supported”
Hi there, I believe I was only one or two driver versions behind, but I just updated them and added the DX9 argument. Sadly there hasn’t been any change in performance.
Hi @alexeyzakharov something else that is strange is that it often stops after awhile. Just standing in the scene with the game running will eventually even out and start running better, if not perfect. Going from 6 frames a second to 50.
Hi! This doesn’t sound right. Could you please file a bug with the detailed information.
From what you have told this seems like vsync issue, but the reason is not clear and should be investigated properly.
Thanks!
How can we help you solve this?
I have Windows 10 FCU with GTX 1070 and had to rollback to NVidia 388.0 drivers since the never ones cause really bad slowdown with Windowed GSync in games. So there’s obviously problems with Windows and NVidia even without Unity, but the periodic slowdowns with Unity may be something different. I’d guess something with (Windowed) G-Sync / Vsync.
@alexeyzakharov I am having this issue aswell. When I used Unity in August, everything was alright. But since I came back (20 november) all my projects (including ones in older unity version 5.6) are having this issue. I have tried countless fixes with no luck.
GTX 970 here, I would guess some geforce driver update messed stuff up.
I would imagine the most help you can provide, is to use the Unity Bug Reporter tool, submit an actual bug-report and post the Case number here for Alexey to pick up. The Bug Reporter tool collects various hardware/driver information of your system, which is probably what Unity needs to sort this out.
Attach a project that UT can use to reproduce the issue and test their fix against. I often attach a screen-recording to show-case the issue as well, to proof that there is problem.
The easier you make it for QA to confirm the issue, the more likely it is that it gets forwarded to a developer to investigate the issue.
Here is a page that describes how Unity Technologies wants us to report bugs:
I was thinking something more in-depth like trying different driver versions / settings to help them narrow it down. A repro project won’t help here since the 30 ms frames also happen in a clean project with an empty scene and obviously don’t happen for everyone. Judging from Alexey’s replies, they may not yet have a good grasp of the issue or the causes.
Just to reiterate:
It’s not about GPU power - happens with GTX 1070 in an empty scene.
Disabling G-Sync mostly fixes the issue, the slow Gfx.WaitForPresent frame times go from >30ms to < 2ms (which still is a “slow” frame in an empty scene though).
@iivo_k , @akuno , @Peter77 Thanks for the help!
Yes, please create a bugreport with a detailed description of what you have already tried and discovered.
This is not a known bug and looks like a driver issue from what you are describing.
@alexeyzakharov I found something interesting today when I did a complete driver wipe and installed July’s drivers. The short of it is that NVIDIA’s ‘In-game Overlay’ is a cause of performance woes in the editor. (Doesn’t seem to be related to driver version, as returning to the latest didn’t make any difference.) I went from 5-15 frames a second in the editor to a steady 30 when disabling the overlay.
Performance still isn’t where it should be (30fps @ 720p in the editor versus 120+fps @ 1440p in a build), but this has had a noticeable improvement and might provide insight into what else might be going on?
For anyone attempting to utilise this, you need to go into GeForce Experience’s settings and disable “IN-GAME OVERLAY”. Simply turning off Instant Replay or any of the other features in the overlay has no effect.
Edit: I didn’t realise rendering the scene view had such a high cost. Turning that off took me from 30 to 80fps. It also removes the strange Profiler behaviour. Where it would say the frame was taking a huge amount of time due to Gfx.WaitForPresent, but if you profiled the graphics card the frame was taking no time!
Edit 2: A build at 720p gets ~270fps. So there’s still a fairly large discrepancy. However not rendering the scene view did give a massive increase!