Game Development Reference
In-Depth Information
StopAllCoroutines
StopAllCoroutines stops all coroutines running on this behavior.
An example of StopAllCoroutines is as follows:
// JavaScript user:
function Start() {
// Start Coroutine DoSomething
StartCoroutine("DoSomething", 5.0);
// Wait for 1 seconds
yield WaitForSeconds(1.0);
// Stop All Coroutine
StopAllCoroutines();
}
function DoSomething (someParameter : float) {
while (true) {
// DoSomething Loop
Debug.Log ("DoSomething Loop = " + Time.time);
// Yield execution of this coroutine and return to the
main loop until next frame
yield;
}
}
// C# user:
IEnumerator Start() {
// Start Coroutine DoSomething
StartCoroutine("DoSomething", 5.0f);
// Wait for 1 seconds
yield return new WaitForSeconds(1.0f);
// Stop All Coroutine
StopAllCoroutines();
}
Search WWH ::




Custom Search