Complete the code to start a coroutine named MyCoroutine.
StartCoroutine([1]);In Unity, to start a coroutine, you call StartCoroutine with the coroutine method call including parentheses, like MyCoroutine().
Complete the code to wait for 2 seconds inside a coroutine.
yield return [1];
new keyword.To wait inside a coroutine, you yield return a new instance of WaitForSeconds with the time in seconds.
Fix the error in the coroutine chaining code to wait for SecondCoroutine to finish before continuing.
yield return [1](SecondCoroutine());
WaitForSeconds instead of StartCoroutine.Invoke which does not return IEnumerator.To wait for another coroutine to finish, you yield return StartCoroutine with the coroutine call.
Fill both blanks to chain two coroutines so that FirstCoroutine waits for SecondCoroutine before continuing.
IEnumerator FirstCoroutine() {
yield return [1](SecondCoroutine());
Debug.Log([2]);
}StartCoroutine to wait.You use StartCoroutine to wait for SecondCoroutine. Then you log a message indicating the second coroutine finished.
Fill all three blanks to create a coroutine that chains three coroutines and logs messages after each finishes.
IEnumerator ChainCoroutines() {
yield return [1](CoroutineOne());
Debug.Log([2]);
yield return [3](CoroutineTwo());
Debug.Log("All coroutines done");
}StartCoroutine for both coroutines.Use StartCoroutine to wait for each coroutine. Log messages after each finishes to show progress.