vsync overrides targetFrameRate in windowed app

If do this in code (Unity 2020.1.14 HDRP):

QualitySettings.vSyncCount = 1;//also if this done in project's QualitySettings
Application.targetFrameRate = 30;

then in the editor it runs at 30 fps, but when built to standalone windowed it runs at 60 fps (vsync presumably).
Bug or feature?!

1 Like

Thanks I do not know how I missed that, I never new… perhaps a console warning would help if set to no avail and as to the Editor NOT behaving in the same way - surely a bug.
Does that mean screen-tearing is bound to happen with targetFrameRate set? Hmm at least it should be smooth with the latest improvements…

I believe targetFrameRate will also enable VSync if below the native refresh rate, but I don’t know for sure. All the documentation hints that that might be the case, but also only references that behavior for mobile devices.

In the editor I believe VSync is always enabled and cannot be disabled for either the scene or game views, even when running at high framerate. Indeed the scene view often runs at several hundred fps w/o tearing, as can the game view. It’s possible the vSyncCount setting is ignored in the editor, though it’s not mentioned in the documentation, and I’ve not needed to use that setting in the last 6 years