Managing time and frame rate
Understand how Unity measures time so you can manage the rate at which time passes in your application and ensure values update according to the appropriate time scale.
Read time 1 minuteLast updated 12 days ago
It's important to understand how Unity handles time to ensure your gameplay remains stable. Updates occur at regular time intervals to capture changes to character positions, health status, scores, and so on. If your code makes changes in the wrong update loop or doesn't allow for variations in time, effects like movement might be too fast, too slow, or jumpy instead of smooth.
The class contains properties through which you can get and in some cases set various time-related measurements and settings. Refer to Time in the Scripting API reference for a complete list of the properties and their meanings.
TimeTopic | Description |
|---|---|
| Per-frame updates | Updates which happen once per frame and whose frequency therefore depends on frame rate. |
| Fixed updates | Updates which happen at a configurable fixed time interval. |
| In-game time and real time | The configurable relationship between in-game time and real time and the potential effects. |
| Handling variation in time | Techniques Unity uses to compensate for variations in time and frame rate and to limit the effects of one-time delays. |
| Capture frame rate | Compensating for frame rate when recording video of gameplay. |
| Simulate hitches for testing | Simulate hitches to test how your game handles time variation caused by performance issues. |