Created
July 26, 2013 04:19
-
-
Save estebanpadilla/6086153 to your computer and use it in GitHub Desktop.
Creates a coroutine block.
The execution of a coroutine can be paused at any point using the yield statement. The yield return value specifies when the coroutine is resumed. Coroutines are excellent when modelling behaviour over several frames. Coroutines have virtually no performance overhead. StartCoroutine function always returns immediately,…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MyCoroutine() { | |
print("Starting " + Time.time); | |
StartCoroutine(StartCoroutine_MyCoroutine(time)); | |
print("Before WaitAndPrint Finishes " + Time.time); | |
} | |
IEnumerator StartCoroutine_MyCoroutine(float waitTime) { | |
yield return new WaitForSeconds(waitTime); | |
print("WaitAndPrint " + Time.time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment