- Unity is ignoring
- The application is capped at higher or lower than target frame rate
- VSync is not capping to 60/30 fps
Unity intentionally ignores
Application.targetFrameRate when VSync Count is active. VSync Count is a property in the Quality settings (Edit > Project Settings > Quality).
VSync syncs the game's frame rate to the refresh rate of the monitor (traditionally 60hz), meaning you are capped at that fps (frames per second) independent of the target frame rate. On modern hardware, including some mobile devices, you can have displays with refresh rates of 120hz or 144hz. On these devices, when VSync Count is set to Every V Blank, they are capped at 120 fps and 144 fps respectively.
When VSync Count is set to Every Second V Blank it is capped at half the refresh rate (for example, 60hz is capped at 30 fps).
If you want to use
targetFrameRate to have finer control over the frame rate, set VSync Count to Don’t Sync. You can change this at run time using the API calls
You might use these API calls when you only want your application to run at a higher frame rate during intense movement scenes, but cap your frame rate during menus.
The code to do this is as follows:
To set the target frame rate to 30 fps:
Application.targetFrameRate = 30; QualitySettings.vSyncCount = 0;
To set it to Every V Blank:
QualitySettings.vSyncCount = 1; Application.targetFrameRate = 60; // This will update the current setting, but be ignored due to vSyncCount being greater than 0.