Skip to main content
Unity3D

Unity3D Scripting API #6: LateUpdate()☑️

By January 27, 2021February 14th, 2021No Comments
Unity3D Scripting API

LateUpdate():

☑️ This is called after each Update() method call

☑️This is useful to ensure all Update() related calculations are completed, and then any other dependent calculations can be called. For example, if you need to integrate a third-person camera to follow a character, then it should be implemented inside LateUpdate() method. This ensures that the camera will track the character after its movement has been updated.

All objects on the scene will be moved first and then the camera will be moved last.

Order of execution:

☑️FixedUpdate(): Called after a fixed time of 0.02 seconds

☑️Update(): Called once after every frame. Depends on the frame rate

☑️LateUpdate(): Called after the Update() method

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CubeController : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Hello");
    }

    // Update is called once per frame

    void Update()
    {
        Debug.Log("-------------Update Method");
    }

    void FixedUpdate()
    {
        Debug.Log("Fixed Method:");
    }
    void LateUpdate()
    {
        Debug.Log("--------Late Method:----------");
    }
}

Leave a Reply