Scripting
Beginner

Update and FixedUpdate

Checked with version: 4

-

Difficulty: Beginner

-

Date: 27 Apr 2015

How to effect changes every frame with the Update and FixedUpdate functions, and their differences.

Update and FixedUpdate

Beginner Scripting

UpdateAndFixedUpdate

Code snippet

using UnityEngine;
using System.Collections;

public class UpdateAndFixedUpdate : MonoBehaviour
{
    void FixedUpdate ()
    {
        Debug.Log("FixedUpdate time :" + Time.deltaTime);
    }
    
    
    void Update ()
    {
        Debug.Log("Update time :" + Time.deltaTime);
    }
}
#pragma strict

function FixedUpdate ()
{
    Debug.Log("FixedUpdate time :" + Time.deltaTime);
}


function Update ()
{
    Debug.Log("Update time :" + Time.deltaTime);
}
import UnityEngine
import System.Collections


public class UpdateAndFixedUpdate(MonoBehaviour):

    private def FixedUpdate():
        Debug.Log(('FixedUpdate time :' + Time.deltaTime))

    
    
    private def Update():
        Debug.Log(('Update time :' + Time.deltaTime))
Awake and Start
Vector Maths

Related documentation

Got it

The Unity Software License Agreement and Privacy Policy have been updated.

We use cookies to ensure that we give you the best experience on our website. Click here for more information.