Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question VSync lowers performance even when it is disabled. Unity 2021.3.10f1 (DX11)

Discussion in 'Editor & General Support' started by unity_AkGames, Oct 3, 2022.

  1. unity_AkGames

    unity_AkGames

    Joined:
    Dec 23, 2020
    Posts:
    10
    I disabled VSync in every quality setting and set Application.targetFrameRate to -1 and yet VSync takes more than half of the frame time. I did run an empty scene and i had the same problem.



     
  2. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    Screen Shot 2022-09-30 at 19.28.07.png this is turned off by default, does turning it on affect performance?
     
  3. unity_AkGames

    unity_AkGames

    Joined:
    Dec 23, 2020
    Posts:
    10
    Yes. When i enabled that option, the frame rate was fixed to 60 Fps. But the screenshot above is from profiling a build of the game and not from the play mode.
     
    enhawk likes this.
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,336
    Do you happen to test this on an adaptive sync monitor? In that case, turning off vsync has no effect beyond the refresh rate of the monitor.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    That's not VSync. It's just waiting for your GPU to finish rendering. Look at your GPU usage in the task manager.
     
  6. unity_AkGames

    unity_AkGames

    Joined:
    Dec 23, 2020
    Posts:
    10
    GPU usage is at 9x%. But if the main thread is waiting for the GPU to finish rendering the frame why would the render thread says "WaitForGfxCommandsFromMainThread"?
    And i dont have this problem in other projects.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    Render thread is idle, it has already submitted all the commands to the GPU and is waiting for more. The GPU is processing the commands and the main thread is waiting on that. Your game seems to be GPU bound (as in the performance is limited by the GPU performance).

    Since the GPU is pretty much maxed out, it can't run any faster.
     
    unity_AkGames likes this.
  8. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    I'm also getting this problem with builds in 2020 / 2021 on mac. Building with 2019 doesn't spin up the graphics card to max (some kind of vsync issue) - theres certainly something up here.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,526
    Perhaps the scene is just more GPU intensive on Unity 2020/2021? At that point, it comes down to looking at assets, materials and all other things in the scene.
     
    DevDunk likes this.
  10. unity_AkGames

    unity_AkGames

    Joined:
    Dec 23, 2020
    Posts:
    10
    I see it now. Thanks!