Search Unity

Windows build has fixed 30fps update rate

Discussion in 'Windows' started by asdfghjkloi87654, Sep 21, 2020.

  1. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    Hi everyone,

    I am developing a windows standalone game. If I run it in the editor, the stats gui tells me it runs at about 400fps. Additionally I implemented my own counter with:
    Code (CSharp):
    1. Debug.LogError(1.0f / Time.deltaTime);
    The results are mostly comparable between my counter and the stats card.

    If I build my game and execute it from its build directory, it prints me always 30fps. I built it in developer mode to have the console active in the build. It is not just a matter of fixed frame rate, my game isn't functioning properly outside the editor, as it relies on quick calls of the update() function.

    I researched this problem and did serveral things to solve it, however none worked.
    1. I went into ProjectSettings -> Quality and deactivated vSync for every Quality tier
    2. I added
    Code (CSharp):
    1. QualitySettings.vSyncCount = 0;
    2. Application.targetFrameRate = -1;
    in the void Start() of a gameobject

    3. I went into my nvidia settings -> 3d settings and turned off vSync.

    I am running on a core i7 and a gtx 770.
    How to get rid of this fps limitation?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Did you try using the profiler to figure where the time is being spent?
     
  3. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    Yeah, The player loop just takes 61ms instead of 2.2ms in the editor. It just takes longer, which is weired.
    A friend of mine doesn't have this problem on his pc, so it seems to be a local problem.

    I installed the newest nvidia drivers, doublechecked all settings regarding vsync and the unity settings.

    I am using a 4k monitor, maybe that comes into play?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Did you try running it in windowed mode at a resolution similar to the editor?
     
  5. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Did you make sure the NVIDIA card is selected as system default?

    graphics_card_select.jpg
     
  6. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    I ran it on the exact same resolution as the editor, no change from 30fps at all.
    I'll include the log file (just the start, it just continues like that) in this post, I deactivated the profiler for this build to minimize impact on the framerate. The fps are printed in the logfile.

    @polemical There is no such setting on my pc. (it says vsync off in the red marking)
    settings.jpg
     

    Attached Files:

    • log.txt
      File size:
      7.6 KB
      Views:
      286
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You should open up the timeline view of the profiler. Can you show a screenshot of that?
     
  8. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    Editor run: (playmode) Eveything as it should, game is doing almost nothing
    editor_run.jpg

    Standalone Run: 30fps consistant, resolution is same, all vsync is off etc.
    standalone_run.jpg
     
  9. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    It is easier to see in this zoomed view. My scripts and everything else seems to do right, this guy seems to be the problem:
    Gfx.WaitForPresentOnGfxThread, waiting for what? it is an empty scene, with a tiny script...
    standalone_run_2.jpg
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    What does your GPU usage look like in task manager when that happens?
     
  11. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    editor playmode around 42%.
    standalone build around 4 to 10%
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you print out QualitySettings.vSyncCount? That just sounds like the build is waiting on VSync.
     
  13. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    Yeah, i think so too. The vSyncCount is 0 always. I print it every frame now and plain 0.
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    You should try setting the Nvidia control panel setting to "Application controlled" instead of off. Also, make sure your game doesn't have special settings in this section:

    upload_2020-9-23_11-27-53.png
     
  15. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    Doesn't work. I tried all combinations of settings up to this point, reinstalled drivers, really a lot of things...
     
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you post the contents of your player log?
     
  17. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    I had to change the file ending to txt, .log is not allowed here
     

    Attached Files:

  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Hmm, interesting. I assume you're running on an older version of Windows?

    Could you report a windows performance recorder trace of a game running at that framerate for around 10 seconds? Here's a guide on how to do it:

    https://files.unity3d.com/zilys/ETWPerfGuide/data/RecordingTraceOnPC.html

    Please use "CPU usage" and "GPU activity" checkboxes. Compress the resulting trace into a .zip/.7z file and send it to me via a private message (don't post it publicly, it may contain personally identifiable information).
     
  19. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    The WPR seems to be broken on my pc, so I think everything is a local issue. I am going to reinstall my os and unity. If the problem persists, I contact you with the performance record.
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Alright let me know how it goes.
     
  21. asdfghjkloi87654

    asdfghjkloi87654

    Joined:
    Feb 16, 2013
    Posts:
    43
    Problem solved by reinstallation.
     
    adamgolden likes this.