Recall & Review
beginner
What is a coroutine in Unity?
A coroutine is a special function that can pause its execution and resume later, allowing you to wait for some time or events without freezing the whole game.
Click to reveal answer
beginner
What return type must a coroutine have in Unity?
A coroutine must return
IEnumerator, which allows Unity to pause and resume the function at yield points.Click to reveal answer
beginner
How do you start a coroutine in Unity?
You start a coroutine by calling
StartCoroutine(MethodName()) inside a MonoBehaviour script.Click to reveal answer
intermediate
What does
yield return null do inside a coroutine?It pauses the coroutine and resumes it on the next frame, letting the game continue running smoothly.
Click to reveal answer
intermediate
Why use coroutines instead of Update() for timed actions?
Coroutines let you write simple, readable code that waits for time or events without checking every frame manually, making your code cleaner and easier to manage.Click to reveal answer
What keyword is used inside a coroutine to pause execution?
✗ Incorrect
The
yield keyword pauses the coroutine until the next frame or specified wait time.Which of these is the correct way to declare a coroutine method?
✗ Incorrect
Coroutines must return
IEnumerator to work properly in Unity.What happens if you call
StartCoroutine with a method that does NOT return IEnumerator?✗ Incorrect
Unity requires coroutines to return
IEnumerator; otherwise, it throws an error.What does
yield return new WaitForSeconds(2) do?✗ Incorrect
It pauses the coroutine for 2 seconds, then resumes execution.
Which Unity class typically contains coroutine methods?
✗ Incorrect
Coroutines are started and run inside classes that inherit from
MonoBehaviour.Explain how coroutines help manage timed actions in Unity games.
Think about how you can wait without freezing the game.
You got /5 concepts.
Describe the steps to create and run a simple coroutine that waits 3 seconds before printing a message.
Focus on method declaration, waiting, and starting the coroutine.
You got /4 concepts.