Game runs fantastic in Editor, but standalone build uses 98% GPU. Both look exactly the same??

I am trying to profile my game but am not having any luck,

In the editor i press play and my GPU usage shows in Precision X1 as GPU usage is ~40%

But when i build the same game as standalone and play I see my GPU ramp to 98% and stays there! :hushed:

I can not see any difference in quality or framerate when playing the game in editor or standalone.

I am not sure how to debug this, my customers are screaming noticing their GPU loads are crazy high and I don’t know what caused it or when it began happening, maybe when I updated Unity versions? i don’t have any idea where to even start…

I am using Unity 2019.4.28f1 and SteamVR
pc specs: Part List - Intel Core i9-9900K, 2 x GeForce RTX 2080 Ti, Cooler Master MasterCase H500M ATX Mid Tower - PCPartPicker

Please someone help me understand why my game in the Editor works so amazing but then when I build and share it everyone’s gpu usage is now really high?

What should I do?

High GPU usage percentage isn’t on its own a problem. How Unity works is Unity will run at the maximum frame rate the hardware is capable of, unless it hits an artificial frame rate cap. That frame rate cap can come from either vsync being enabled, or if you have set the value in Application.targetFrameRate.

If neither vsync nor targetFrameRate are used, frame rates will increase until you hit a hardware bottleneck, typically either GPU or CPU. For GPU the behavior will be at or near 100% reported usage. For CPU it is a little more complicated to see from the outside due to the main thread nature of Unity running on CPU’s with multiple cores.

Differences between the editor and a standalone build are often several different reasons. In the editor, you’re sharing the main thread with the Editor itself. In the Editor all your code is run unoptimized. In the Editor typically you’re running in a smaller window. All these reasons typically favor hitting a CPU bottleneck in the Editor where you won’t necessarily see the same performance in a build.

You should be doing the majority of your play testing and all performance testing in a build by the way. The Play mode in the Editor is there for your convenience, but don’t assume it represents the actual build experience.

1 Like

I just added a slider to my project that allows me to set the Application.targetFrameRate value respectively.

And I added this script for measuring the FPS (because i think Unity stats are not accurate): FPS Counter

But when I build and run my game then try adjusting the slider nothing happens!! No matter what value I set the framerates are maxing out and melting my GPU.

I have searched my entire project and commented out any calls to Application.targetFrameRate or QualitySettings.vSyncCount so I am pretty sure they are not getting set from anywhere except for the slider onChange callback:

void TargetFramerateSliderChanged(float val) //when the slider is changed
{
    Screen.SetResolution (1920, 1080, false);
    QualitySettings.vSyncCount = 0;
    Application.targetFrameRate = (int)val;
}

However if I start the game using ‘-vrmode none’ then I can adjust the framerate just fine.

So I think it is VR related but I absolutely need to be able to reduce the framerates so my customer’s GPUs are not catching fire.

My game is a mocap game, and only needs 60fps, VR is optional and not very important but is required.

How can I allow users to turn down the FPS in my Steam VR game??

Digging through SteamVR code I see SteamVR.settings.lockPhysicsUpdateRateToRenderFrequency but even after disabling it the targetFrameRate still has no effect.

So I look for other options and see SteamVR_Render.pauseRendering hoping this could possibly help cool down my GPUs when not using VR, But the exact oppisite happens!!! When I set pauseRendering to True my GPU goes to 100% and FPS ramps to ~200 !!! :hushed::hushed::hushed::hushed:

One of my 2080TI GPUs already failed due to thermal issues and needed RMA, It’s beacuse of Unity pushing them to the absolute limit without any way to control. And I don’t need 120FPS ever.

How do I control the framerates?? Turn them down in a VR game??

I managed to fix it by using Thread.Sleep() to limit the framerates.