Unity - Scripting API: Application.targetFrameRate
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
public static int targetFrameRate;
Description
Specifies the target frame rate at which Unity tries to render your application.
Accepts an integer > 0, or special value -1 (default).
Desktop
- If QualitySettings.vSyncCount is set to
0, thenApplication.targetFrameRatechooses a target frame rate for the application. IfvSyncCount != 0, thentargetFrameRateis ignored. - When
QualitySettings.vSyncCount = 0andApplication.targetFrameRate = -1, content is rendered unsynchronized as fast as possible. - It's recommended to use
QualitySettings.vSyncCountoverApplication.targetFrameRatebecausevSyncCountimplements a hardware-based synchronization mechanism, whereastargetFrameRateis a software-based timing method and is subject to microstuttering. - Setting
vSyncCount = 0and usingtargetFrameRatewill not produce a completely stutter-free output. Always usevSyncCount > 0when smooth frame pacing is needed.
Web
- If QualitySettings.vSyncCount is set to
0, thenApplication.targetFrameRatechooses a target frame rate for the application. IfvSyncCount != 0, thentargetFrameRateis ignored. - When
QualitySettings.vSyncCount = 0andApplication.targetFrameRate = -1, content is rendered at the native display refresh rate. - It's recommended to use QualitySettings.vSyncCount over
Application.targetFrameRatebecausevSyncCountimplements a hardware-based synchronization mechanism, whereastargetFrameRateis a software-based timing method and is subject to microstuttering. - Setting
vSyncCount = 0and usingtargetFrameRatewill not produce a completely stutter-free output. Always usevSyncCount > 0when smooth frame pacing is needed. - Rendering is always limited by the maximum refresh rate of the display. Setting
vSyncCount = 0andtargetFrameRateto an arbitrarily high value will not exceed the display's native refresh rate, even if the rendering workload is sufficiently low.
Android
- Use
targetFrameRateto control the frame rate of your application. This is useful for capping your application's frame rate to make sure your application displays smoothly and consistently under heavy rendering workloads. You can reduce your application's frame rate to conserve battery life and avoid overheating on mobile devices. - When
QualitySettings.vSyncCount = 0andApplication.targetFrameRate = -1, content is rendered at a fixed 30 fps to conserve battery power, independent of the native refresh rate of the display.QualitySettings.vSyncCount > 0are ignored. - Rendering is always limited by the maximum refresh rate of the display. Setting
vSyncCount = 0andtargetFrameRateto an arbitrarily high value will not exceed the display's native refresh rate, even if the rendering workload is sufficiently low. - To render at the native refresh rate of the display, set
Application.targetFrameRateto the value from the Resolution.refreshRateRatio field of the Screen.currentResolution property. - If the specified rate doesn't evenly divide the current refresh rate of the display, then the value of
Application.targetFrameRateis rounded down to the nearest number that does. For example, when running on a 60 Hz Android display, andApplication.targetFrameRate = 25, content is rendered at 20 fps as 20 is the highest number below 25 that divides 60 evenly.
iOS
- Use
targetFrameRateto control the frame rate of your application. This is useful for capping your application's frame rate to make sure your application displays smoothly and consistently under heavy rendering workloads. You can also reduce your application's frame rate to conserve battery life and avoid overheating on mobile devices. - When
QualitySettings.vSyncCount = 0andApplication.targetFrameRate = -1, content is rendered at a fixed 30 fps to conserve battery power, independent of the native refresh rate of the display.QualitySettings.vSyncCount > 0are ignored. - Rendering is always limited by the maximum refresh rate of the display. Setting
vSyncCount = 0andtargetFrameRateto an arbitrarily high value will not exceed the display's native refresh rate, even if the rendering workload is sufficiently low. - To render at the native refresh rate of the display, set
Application.targetFrameRateto the integer representation of the screen's refresh rate. This can be retrieved from the value of theScreen.currentResolution.refreshRateRatioproperty. For example,Application.targetFrameRate = (int)Screen.currentResolution.refreshRateRatio.value;. - The native refresh rate of the display is controlled by the Apple ProMotion feature. When ProMotion is disabled in the project (default for new projects), the native refresh rate is 60 Hz. When ProMotion is enabled, the native refresh rate is 120 Hz on the iOS displays that support ProMotion, 60 Hz otherwise.
- If the specified rate doesn't evenly divide the current refresh rate of the display, then the value of
Application.targetFrameRateis rounded down to the nearest number that does.