What if your game's physics felt glitchy just because your computer runs faster or slower?
FixedUpdate vs Update in Unity - When to Use Which
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.
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.
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.
void Update() {
MoveBall();
CheckPhysics();
}void Update() {
MoveBallSmoothly();
}
void FixedUpdate() {
ApplyPhysics();
}You can create games where animations look smooth and physics behave realistically, no matter how fast or slow the computer runs your game.
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.
Update runs every frame for smooth visuals.
FixedUpdate runs at fixed intervals for stable physics.
Using both properly avoids glitches and improves game feel.