Complete the code to wait for 2 seconds before printing a message.
IEnumerator WaitAndPrint() {
yield return new [1](2f);
Debug.Log("Waited 2 seconds");
}WaitForSeconds pauses the coroutine for the given seconds.
Complete the code to wait until the end of the current frame before continuing.
IEnumerator WaitForFrameEnd() {
yield return new [1]();
Debug.Log("Frame ended");
}WaitForEndOfFrame waits until the frame rendering is done before continuing.
Fix the error in the coroutine to wait for 3 seconds before printing.
IEnumerator WaitThreeSeconds() {
yield return new [1](3f);
Debug.Log("3 seconds passed");
}WaitForSeconds requires a float parameter for seconds to wait.
Fill both blanks to create a coroutine that waits for the end of frame, then waits 1 second.
IEnumerator WaitFrameThenSecond() {
yield return new [1]();
yield return new [2](1f);
Debug.Log("Waited frame end and 1 second");
}First wait for the frame to end, then wait for 1 second.
Fill all three blanks to create a coroutine that waits 0.5 seconds, then waits for frame end, then waits 2 seconds.
IEnumerator ComplexWait() {
yield return new [1](0.5f);
yield return new [2]();
yield return new [3](2f);
Debug.Log("Completed complex wait");
}Wait 0.5 seconds, then wait for frame end, then wait 2 seconds.
