0
0
Unityframework~5 mins

WaitForSeconds and WaitForEndOfFrame in Unity - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does WaitForSeconds do in Unity?

WaitForSeconds pauses a coroutine for a set amount of time in seconds before continuing.

Click to reveal answer
beginner
What is the purpose of WaitForEndOfFrame in Unity?

WaitForEndOfFrame waits until all rendering and GUI is done for the current frame, then continues the coroutine.

Click to reveal answer
beginner
How would you use WaitForSeconds to wait 3 seconds inside a coroutine?
yield return new WaitForSeconds(3f);

This pauses the coroutine for 3 seconds.

Click to reveal answer
intermediate
When would you choose WaitForEndOfFrame over WaitForSeconds?

Use WaitForEndOfFrame when you want to run code after the frame finishes rendering, for example to capture screenshots or update UI after all drawing.

Click to reveal answer
intermediate
Can WaitForSeconds be used to wait less than a frame time?

No, WaitForSeconds waits at least the specified seconds, but the actual wait depends on frame rate. For very short waits, WaitForEndOfFrame or other methods may be better.

Click to reveal answer
What does yield return new WaitForSeconds(2f); do in a coroutine?
AImmediately continues the coroutine
BPauses the coroutine for 2 seconds
CWaits until the end of the current frame
DStops the coroutine permanently
When does WaitForEndOfFrame resume the coroutine?
AAfter all rendering and GUI for the current frame is done
BAfter 1 second has passed
CAt the start of the next frame
DImmediately without waiting
Which is true about WaitForSeconds?
AIt waits exactly the specified time regardless of frame rate
BIt only works outside coroutines
CIt waits until the end of the frame
DIt waits at least the specified time, but actual wait depends on frame rate
Which Unity feature uses WaitForSeconds and WaitForEndOfFrame?
AAnimation clips
BPhysics engine
CCoroutines
DLighting system
If you want to run code after the frame is fully drawn, which should you use?
AWaitForEndOfFrame
BWaitForSeconds
CWaitForFixedUpdate
DWaitForUpdate
Explain the difference between WaitForSeconds and WaitForEndOfFrame in Unity coroutines.
Think about when the coroutine continues in each case.
You got /4 concepts.
    Describe a situation where using WaitForEndOfFrame is better than WaitForSeconds.
    Consider tasks that require the frame to be fully drawn first.
    You got /4 concepts.