Select your preferred scripting language. All code snippets will be displayed in this language.
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.
CloseFor 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.
CloseThe time in seconds it took to complete the last frame (Read Only).
Use this function to make your game frame rate independent.
If you add or subtract to a value every frame chances are you should multiply with Time.deltaTime.
When you multiply with Time.deltaTime you essentially express:
I want to move this object 10 meters per second instead of 10 meters per frame.
When called from inside MonoBehaviour's FixedUpdate, returns the fixed framerate
delta time.
Note that you should not rely on Time.deltaTime from inside OnGUI since OnGUI
can be called multiple times per frame and deltaTime would hold the same value each call, until
next frame where it would be updated again.
function Update () { // Move the object 10 meters per second! var translation : float = Time.deltaTime * 10; transform.Translate (0, 0, translation); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Update() { float translation = Time.deltaTime * 10; transform.Translate(0, 0, translation); } }
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