Skip to content

Instantly share code, notes, and snippets.

@estebanpadilla
Created July 26, 2013 04:19
Show Gist options
  • Save estebanpadilla/6086153 to your computer and use it in GitHub Desktop.
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,…
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