Unity  

Difference Between FixedUpdate and Update in Unity

When developing games in Unity, understanding the core game loop and how different update methods work is crucial for writing efficient and bug-free code—especially for physics and frame-dependent behaviors. Two key functions that often confuse beginners and even intermediate Unity developers are Update() and FixedUpdate().

This article breaks down the differences between FixedUpdate and Update, explaining when to use each and how they behave under the hood.

1. What is Update()?

Update() is a MonoBehaviour method that is called once per frame. It is frame-dependent, meaning its call rate varies depending on the frame rate (frames per second, or FPS) of the game.

How does it work?

If your game runs at 60 FPS, Update() is called 60 times per second. If the frame rate drops to 30 FPS, it’s only called 30 times per second.

void Update() {
    // Called once per frame
    MovePlayer();
}

Best for

  • User input handling (like Input.GetKeyDown)
  • Non-physics-based logic (like UI updates or score counters)
  • Camera updates
  • Simple animations or effects tied to the framerate

2. What is FixedUpdate()?

FixedUpdate() is also a MonoBehaviour method, but unlike Update, it is called on a fixed, consistent interval (by default, every 0.02 seconds or 50 times per second).

How does it work?

It’s independent of the frame rate. Regardless of the FPS, Unity will call FixedUpdate() based on the fixed timestep that has been defined.

Edit > Project Settings > Time > Fixed Timestep.

void FixedUpdate() {
    // Called on a fixed time interval
    ApplyPhysicsForces();
}

Best for

  • Physics-related code (e.g., Rigidbody.AddForce())
  • Consistent motion using physics engines
  • Network sync where deterministic updates are needed

3. Comparison Table

Feature Update() FixedUpdate()
Call Frequency Once per rendered frame Fixed time interval (default 0.02s)
Frame Rate Dependent Yes No
Best for Input, UI, animations Physics, Rigidbody interactions
Tied to Physics No Yes
Use With Rigidbody Avoid (can cause jitter) Recommended

4. Practical Example

Bad Practice: Using Update() for Physics

void Update() {
    rigidbody.AddForce(Vector3.forward); // This can cause stutter or jitter
}

Good Practice: Using FixedUpdate() for Physics

void FixedUpdate() {
    rigidbody.AddForce(Vector3.forward); // Smooth and consistent
}

Why? Because physics calculations run in sync with the fixed timestep engine. If you apply force in Update(), you risk applying inconsistent forces per frame, especially if your frame rate fluctuates.

5. How Unity Handles the Timing Behind the Scenes?

  • Unity runs physics calculations and calls FixedUpdate() at regular intervals, regardless of the frame rate.
  • Unity calls Update() every frame after all FixedUpdate() and physics have run.
  • If the frame rate is very high, Update() may be called more frequently than FixedUpdate().
  • If the frame rate is low, Unity may call FixedUpdate() multiple times per frame to keep up with real-time physics.
    // Simplified internal Unity sequence:
    FixedUpdate() -> Physics Simulation -> Update() -> Render Frame

6. Summary: When Should You use What?

Use Case Recommended Function
Handling player input Update()
Applying Rigidbody forces FixedUpdate()
Animating UI elements Update()
Moving physics objects smoothly FixedUpdate()
Camera following the player LateUpdate() (bonus!)

💡 Tip: If you read input in Update() and act on it in FixedUpdate() (e.g., storing it in a variable), you can get the best of both worlds: responsive input and physics consistency.

Bonus: LateUpdate() – A Quick Mention

  • Called after Update() every frame.
  • Best used for camera follow logic or any process that should occur after other objects have updated.

Final Thoughts

Understanding the difference between Update() and FixedUpdate() can help you.

  • Avoid physics bugs and jittery behavior.
  • Optimize your game performance.
  • Write more predictable and stable gameplay logic.

As a Unity developer, using these functions appropriately will give your game smoother control and better performance, especially on devices with variable frame rates, such as mobile or VR.