Specifies the target frame rate at which Unity tries to render your game.
An integer > 0, or special value -1 (default).
Desktop and Web: If QualitySettings.vSyncCount is set to 0, then Application.targetFrameRate
chooses a target frame rate for the game. If vSyncCount != 0
, then targetFrameRate
is ignored.
Android and iOS: Mobile platforms always ignore QualitySettings.vSyncCount and instead use Application.targetFrameRate
to choose a target frame rate for the game. Use targetFrameRate
to control the frame rate of your game. This is useful for capping your game's frame rate to make sure your game displays smoothly and consistently under heavy rendering workloads. You can also reduce your game's frame rate to conserve battery life and avoid overheating on mobile devices.
When QualitySettings.vSyncCount = 0
and Application.targetFrameRate = -1
:
- Desktop: Content is rendered unsynchronized as fast as possible.
- Web: Content is rendered at the native display refresh rate.
- Android and iOS: Content is rendered at fixed 30 fps to conserve battery power, independent of the native refresh rate of the display.
Desktop and Web: It is recommended to use QualitySettings.vSyncCount
over Application.targetFrameRate
because vSyncCount
implements a hardware-based synchronization mechanism, whereas targetFrameRate
, which is a software-based timing method is subject to microstuttering. In other words, on Desktop and Web platforms, setting vSyncCount = 0
and using targetFrameRate
will not produce a completely stutter-free output. Always use vSyncCount > 0
when smooth frame pacing is needed.
Web, Android and iOS: Rendering is always limited by the maximum refresh rate of the display. Setting vSyncCount = 0
and targetFrameRate
to an arbitrary high value will not exceed the display's native refresh rate, even if the rendering workload is sufficiently low.
Android and iOS: To render at the native refresh rate of the display, set Application.targetFrameRate
to the value from the Resolution.refreshRateRatio field of the Screen.currentResolution property.
iOS: 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.
Android and iOS: If the specified rate does not evenly divide the current refresh rate of the display, then the value of Application.targetFrameRate
is rounded down to the nearest number that does. For example, when running on a 60Hz Android display, and Application.targetFrameRate = 25
, then content is effectively rendered at 20fps, since 20 is the highest number below 25 that divides 60 evenly.
VR platforms
VR platforms ignore both QualitySettings.vSyncCount and Application.targetFrameRate
and instead, the VR SDK controls the frame rate.
Unity Editor
In the Editor, Application.targetFrameRate
affects only the Game view. It has no effect on other Editor windows.
See Also: QualitySettings.vSyncCount, Screen.currentResolution.
using UnityEngine;
public class Example { void Start() { // Limit framerate to cinematic 24fps. QualitySettings.vSyncCount = 0; // Set vSyncCount to 0 so that using .targetFrameRate is enabled. Application.targetFrameRate = 24; } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.