Application.targetFrameRate = 30;
Runs at 60fps. Any clues? Yes it’s a standalone desktop build with vsync forced on. Tried all other values too. It’s simply ignored. What am I doing wrong?
Application.targetFrameRate = 30;
Runs at 60fps. Any clues? Yes it’s a standalone desktop build with vsync forced on. Tried all other values too. It’s simply ignored. What am I doing wrong?
From the docs page for Application.targetFrameRate:
Oh man, how did I miss that?
Thanks piggy, made my day.
also, targetframerate is ignored in editor
I’m on 5.1.1f1 and targetFramerate works fine in the (windows) editor, provided you set QualitySettings.vSyncCount = 0 before requesting the targetframerate.
I’m sorry, I’m facing that issue too (in a VR project, maybe it’s related ?)
I’m trying to cap framerate to 30fps (just to track down a bug), I’m doing :
public class FPSCapper : MonoBehaviour
{
public int target = 30;
void Awake()
{
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = target;
}
void Update()
{
Debug.Log("V sync : " + QualitySettings.vSyncCount);
Debug.Log("Target framerate : " + Application.targetFrameRate);
}
}
And the console correctly displays :
V sync : 0
Target framerate : 30
…on every frame (so I’m sure there are no other scripts overriding these values)
But still, the gamestat window displays FPS going far beyond the 30 value (and it really does)
Any idea why ?