Game Development Reference
In-Depth Information
// Stop Coroutine DoSomething
StopCoroutine("DoSomething");
}
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;
}
}
StopCoroutine
Stops all corouines for the speciic method name running on this behavior.
Only StartCoroutine using a string method name can
be stopped using StopCoroutine .
Example
function Start() {
/ / Start Coroutine DoSomething
StartCoroutine("DoSomething", 5.0);
// Wait for 2 seconds
yield WaitForSeconds(2.0);
// Stop Coroutine DoSomething
StopCoroutine("DoSomething");
}
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;
}
}
 
Search WWH ::




Custom Search