Hi guys,
I don’t know what to do anymore. My game is running very smoothly in Editor (1000 FPS). When I build it and run the build, if I have the focus on the window, the game runs at 30 FPS. When I click away from the window and it loses focus (I can still play and see it), the game is at 1000 FPS again.
When I stream my screen with the game on discord, I don’t have any issue even if the window is focused (1000 FPS).
Here’s what my profiler has to say about this:
When the game window is in focus:
When the game window is not in focus:
I don’t know what to do anymore, I’ve tried fiddling with nvidia settings but it didn’t change a thing. If you need any information, don’t hesitate to ask.
I couldn’t tell you why it’s set to 30 rather than 60 (or your monitor’s refresh rate, at any rate), but chances are it’s entirely due to vertical sync capping your frame rate while focused, and not bothering to synchronize when it’s not the focused window (since that wouldn’t be considered “important” at that time).
With regard to streaming video, the streaming very likely just doesn’t support vertical sync, so it’s disabled during gameplay.
Yeah that is also what I thought, but vsync is disabled both in nvidia control panel and my game, and is not showing on the profiler (in yellow).
[Edit] Apparently, I don’t encounter this issue when my game is windowed (even if focused). I have this issue in exclusive fullscreen, window fullscreen and borderless window.
[Edit 2] It seems this issue is linked to the fact that I have a duplicate desktop and I am running the game on two screens at the same time. Focusing outside the window or only enabling one screen fixes it.