Scripting
Beginner

Update and FixedUpdate

Checked with version: 4.0

-

Difficulty: Beginner

-

Date: 13 Mar 2014

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