In Unity, what is the difference between Awake, Start, Update, FixedUpdate and LateUpdate?
What the interviewer wants to hear
- Awake runs when the object is loaded, before Start
- Start runs before the first Update if the component is enabled
- Update runs once per frame for game logic and input
- FixedUpdate runs at the fixed physics step
- LateUpdate runs after all Updates, good for cameras
Model answer
Awake is called when the object is created or the scene loads, even if the component is disabled, so I use it to set up references to its own components. Start is called once before the first frame Update, only if the component is enabled, so it is a good place for setup that depends on other objects already being awake. Update runs once per frame and is where I read input and run most game logic, using Time.deltaTime. FixedUpdate runs at the fixed physics rate, which may be zero, one or several times per frame, so I apply Rigidbody forces there. LateUpdate runs after all Update calls in the frame, which makes it ideal for a follow camera, so it moves after the player has moved.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Game Developer questions
- What is a game loop, and why is delta time important?
- How do you use vectors, dot product and cross product in game development?
- How does collision detection work in a game engine, and what is the difference between a collider and a trigger?
- Tell me about a game or game feature you built. What was the hardest problem and how did you solve it?
- Why do game engines like Unity and Unreal favour components over deep inheritance trees for game objects?
- How would you set up version control for a small game team with programmers and artists?
- What do you do as a programmer to make a game "feel" good to play?
- What are coroutines in Unity, and when would you use them instead of Update or async/await?
- How do you use prefabs, nested prefabs and prefab variants to keep a Unity project organised?