Understanding Updates in Unity

Have you ever wonder why Unity has so many update methods? Update, FixedUpdate, LateUpdate, what is going on here?!

When you are programming in Unity, you can see that besides Update, there is also FixedUpdate. When you first see it, you will definitely ask, “What is the difference between those two?”.

Well, there is a short answer, but you also need to know when to use each of them.

In short, Update() is a method called before every frame will be rendered. For example, if your game is running in 60 fps than Update will be called 60 times per second.

There is also LateUpdate(), which is called after all Update() methods. This is still in the same frame as Update(), so you can make some last-minute changes before the frame is rendered.

FixedUpdate(), on the other hand, is independent from rendering and it’s working with the physic engine in Unity. Therefore it might be called between frames or not, which depends on how big is Fixed Timestep in your project.

Time tab in Project Settings of your project.

By default, this value is set to 0.02, so FixedUpdate() will run every 0.02 second without considering if the previous call was finished.

When to use each of them?

Update() is a place where you put regular game logic. It’s perfect for animations, tweens or other timers. You can also move objects that are not physic-based here. A good practice is to use Time.deltaTime to ease a movement.

LateUpdate() is not used that often, especially in small projects. The main benefit here is that LateUpdate() is called after ALL Update() methods. This creates a perfect space to implement Camera movement, as all objects on the scene will be moved first, and the camera will be moved last. Still, we shouldn’t move any physic object here.

FixedUpdate(), as we mentioned before, is tied to the physic engine. This method is a place where you should put all physic interactions like adding a force or moving a physic object. Reason for it is that after the FixedUpdate() method all necessary physic calculations are performed.

Exercise for you

Try to create a physic object and move it on FixedUpdate, and make a camera follow it in the regular Update method without any interpolation.

Let me know if you find any odd behavior in the comment section below! ?

If you want to get notified on future content, sign up for the newsletter!

And I hope to see you next time! ?

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x