Get Your Personalized Game Dev Plan Tailored tips, tools, and next steps - just for you.

Late Update in Unity

Posted by Gemma Ellison
./
August 21, 2023

I was talking with one of my friends the other day. He was asking me about when he should use Update() vs. LateUpdate(). Should he just always use LateUpdate()? Or always Update()? Or manually set the Execution Order? Probably not that last option. Both Update() and LateUpdate() are useful event functions in Unity. If you understand how to use both of them, then you can build a better project. And, you can build it faster with fewer weird bugs.

What you need to know about LateUpdate

  • LateUpdate is an event function that Unity calls after it calls Update().
  • LateUpdate is great for when you need to move the Camera or other Object to track an object that changes during Update.
  • LateUpdate is called every frame.

How do I use Late Update?

Using LateUpdate is easy. Just declare the method signature in your class like you would with Update() or Start(). Here’s an example:


using UnityEngine;

public class LateUpdateExample : MonoBehaviour

{

   Transform target;

   void LateUpdate()

   {

       transform.LookAt(target);

   }

}

Understanding LateUpdate

In this article, we will review the Late Update function. Late Update is a basic update function in Unity that you will use often when making a game. You must understand how Late Update works and when to use it in order to build good games.

Understanding Unity Update Functions

Update functions in Unity are like checkpoints during gameplay where you can add your code to make things happen.

Update functions are called every frame.

Unity offers three major checkpoints that you can hook into.

  • Update(): Regular updates for general game logic stuff.
  • FixedUpdate(): Deals with how physics objects move in the game.
  • LateUpdate(): The one we’re talking about. It comes after the others and is great for adjusting things like the camera, animations, or dependent objects.

In this article, we’ll focus on LateUpdate() in order to understand how to use it.

Why are Update Functions Important in Game Development?

Update functions make it easy for you to control how the game behaves from frame-to-frame. You can depend on Unity to call every Update function on every component every single frame. This makes it easy for you to listen for player input, check for physics interactions, or track in-game actions.

Understanding Late Update in Unity

Late Update in Unity is like a helper that comes after the main work is done. It’s a special moment when you can fix things just before showing them on the screen.

A game loop is a series of tasks. The engine executes each task in order. Then, it starts again from the top.

Late Update is one of these tasks. It happens after the engine has finished most of the other tasks. It is super useful. You use it to adjust an object or component in response to a change that took place during Update or FixedUpdate.

Unity has a helpful page that goes in depth on the series of tasks that it runs through during the lifecycle of your game. This series of tasks is referred to as the Execution Order: https://docs.unity3d.com/Manual/ExecutionOrder.html

The most important event functions in Unity, in chronological order

I went ahead and documented the most crucial event functions that you need to know about. Unity executes plenty more tasks than this. But, you should start with understanding these.

Create a free account, or log in.

Gain access to free articles, game development tools, and game assets.