Can't disable vSync (very odd case)

QualitySettings / VSync Count is set to Don’t Sync. Also I do following during Start():

Application.targetFrameRate = -1;
QualitySettings.vSyncCount = 0;

But the game still runs on 60 FPS. The problem persists on both Unity 2019.3.7f1 and 2019.2.11f1. I don’t have any overrides in my NVidia settings. Other games can run without vSync normally.

Please, find example project in the attachment.

6135812–669254–vSync_test.zip (19.7 KB)

1 Like

You don’t use Debug.Log in your script; maybe you should to see what it has to say. :slight_smile:

Now I added Debug.Log():

    void Start()
    {
        Debug.Log( $"Before: { Application.targetFrameRate }, { QualitySettings.vSyncCount }" );

        Application.targetFrameRate       = -1;
        QualitySettings.vSyncCount        = 0;

        Debug.Log( $"After: { Application.targetFrameRate }, { QualitySettings.vSyncCount }" );
    }

And I see in the log:

Before: -1, 0
After: -1, 0

But the project still runs 60 FPS.

By the way, in Unity Editor it runs with 245 FPS.

What’s happening here? Very strange…

It seems to be computer related; are you sure vSync is disabled in your GPU settings? And, if it is, are you sure there is no safety somewhere that would force vSync on even if you don’t want?

Yes, I’m sure. You can see it on the screenshot - it’s NVidia Control Panel. It says “Use 3D application’s setting”. Same results if I change it to “Disabled”. And same results if press “Restore” button, to restore global settings.

But what it possibly could be? Especially if other games can run with or without vSync. Including my own old game, which I made on SDL2 & OpenGL. I suspect it’s on Unity side.

Actually, you are right! I’ve just tried same build on another computer and it runs without vSync normally.

But what possibly can ban vSync disabling on my computer??? And how it can ban only Unity builds but not other apps? I can’t understand…

1 Like

I wish I knew too; I’ve noticed this behaviour on my current computer. My GPU is an Nvidia too.

1 Like

New results. Disabled vSync is working for Fullscreen Mode = Exclusive Fullscreen only. But for all other modes is not. And!!! This is only in Unity 2019.3.7f1 !!!

In Unity 2019.2.11f1 disabled vSync is not working for all Fullscreen Modes !!!

Extremely strange…

2 Likes

I’m happy that I’m not alone :stuck_out_tongue:

Having the same problem on a mac with AMD Radeon Pro 5500M . Any updates on this

My mistake was very simple, as it turned out I forgot to uncheck Vsync (Game view only), this is where you can change the resolution and aspect ratio of the screen :slight_smile:

Is there a commandline switch for Unity games that will force vsync on when the game does not have it buit in?

You can do it via the NVidia Control Panel

There might also be a way to enable it via boot.config if the game doesn’t override it but couldn’t find the variable name in a quick check.

Hello for everyone having issues after doing all the following possible resolutions and having the same issue.

This is something what helped me:

  1. Turning Vertical sync On on the Nvidia Control Panel as shown. Running the game, closing it. Turning Vertical sync Off. Running the game.
  2. Modifying the Realtime GI CPU Usage(Project Settings > Quality) from Low(in my case) to presumably anything else.
  3. Building the game. After that the issue should be resolved and you can put the Realtime GI CPU Usage to the right setting.

This is what helped me, hope it helps!

9845832--1417038--Screenshot 2024-05-21 001912.png

Vsync on/off worked for me in editor/ game mode, but not in build.

My nvidia control panel was already set to “use the 3d application setting”.

So I tried selecting “off”.

VSync still seemed to be forcing itself on in build

So I tried it again in NVidia’s control panel, except this time, I was sure to hit the “Apply” button as well. It takes about 5 seconds to apply.

Now vsync is off in build.

2022.1.14f