0
0
Unityframework~5 mins

Coroutine basics (IEnumerator) in Unity - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Ayield
Bwait
Cpause
Dstop
Which of these is the correct way to declare a coroutine method?
Avoid MyCoroutine()
BIEnumerator MyCoroutine()
Cint MyCoroutine()
DCoroutine MyCoroutine()
What happens if you call StartCoroutine with a method that does NOT return IEnumerator?
AIt works normally
BThe coroutine runs instantly without pausing
CThe game crashes
DUnity throws an error
What does yield return new WaitForSeconds(2) do?
AWaits 2 seconds before continuing the coroutine
BStops the coroutine permanently
CWaits 2 frames before continuing
DSkips 2 seconds instantly
Which Unity class typically contains coroutine methods?
ARigidbody
BGameObject
CMonoBehaviour
DTransform
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.