Version: 5.6 (switch to 2017.1b)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Time.maximumDeltaTime

Suggest a change

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.

Close

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.

Close

Cancel

public static var maximumDeltaTime: float;
public static float maximumDeltaTime;

Description

The maximum time a frame can take. Physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate).

Will be performed only for this duration of time per frame.

Use this function to avoid low frame rate spikes occurring due to combination of GarbageCollector and expensive physics or other fixed frame rate updates.

If frame will take longer than specified value, then less physics and other fixed frame rate updates will be performed. That will temporarily slow down the gameplay, but will allow frame rate to catchup avoiding nasty stuttering.

It is advisable to keep maximum time for frame between 1/10th and 1/3th of a second.