0
0
Unityframework~3 mins

FixedUpdate vs Update in Unity - When to Use Which

Choose your learning style9 modes available
The Big Idea

What if your game's physics felt glitchy just because your computer runs faster or slower?

The Scenario

Imagine you are making a game where a ball moves and bounces. You try to update the ball's position and check for collisions manually every frame without thinking about timing.

The Problem

Doing everything in one place every frame can cause the ball to jump or behave oddly because the frame rate changes. Sometimes the ball moves too fast or too slow, making the game feel unfair or glitchy.

The Solution

Unity gives you two special methods: Update runs every frame for smooth animations, and FixedUpdate runs at fixed time steps for physics. Using them correctly keeps movement smooth and physics stable.

Before vs After
Before
void Update() {
  MoveBall();
  CheckPhysics();
}
After
void Update() {
  MoveBallSmoothly();
}
void FixedUpdate() {
  ApplyPhysics();
}
What It Enables

You can create games where animations look smooth and physics behave realistically, no matter how fast or slow the computer runs your game.

Real Life Example

In a racing game, the car's steering feels responsive and smooth (Update), while the car's speed and collisions stay accurate and fair (FixedUpdate), making the game fun and playable.

Key Takeaways

Update runs every frame for smooth visuals.

FixedUpdate runs at fixed intervals for stable physics.

Using both properly avoids glitches and improves game feel.