What are coroutines in Unity, and when would you use them instead of Update or async/await?
What the interviewer wants to hear
- Coroutines are methods that pause with yield and resume on later frames
- Good for sequences over time like fades, timed spawns or cutscenes
- They run on the main thread, not in parallel
- They stop when the object is deactivated or destroyed
- async/await or Awaitable suits waiting on IO and composing results
Model answer
A coroutine is a method that returns IEnumerator and can pause with yield, then continue on a later frame. For example, yield return new WaitForSeconds(2) waits two seconds without blocking the game. I use them for sequences over time, such as fading the screen, spawning waves with delays, or a simple cutscene, because the code reads top to bottom instead of being split across state flags in Update. They are not threads: everything still runs on the main thread, so heavy work inside them still causes hitches. They also stop if the GameObject is deactivated. For loading files, web requests or chaining results, I prefer async with Unity's Awaitable type, which handles cancellation and return values more cleanly.
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?
- In Unity, what is the difference between Awake, Start, Update, FixedUpdate and LateUpdate?
- 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?
- How do you use prefabs, nested prefabs and prefab variants to keep a Unity project organised?