Stops all coroutines running on this behavior.
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 yiel ]
The methods discussed earlier are referenced from the following pages:
http://unity3d.com/support/documentation/ScriptReference/index.Coro ines_26_Yield.html
http://unity3d.com/support/documentation/ScriptReference aitForSeconds.html
http://unity3d.com/support/documentation/ScriptReference/Wai orFixedUpdate.html
http://unity3d.com/support/documentation/ScriptRefe nce/Coroutine.html
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.StartCorou ne.html?from=index
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviou Coroutine.html
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.StopAllCoroutines.html
The following link provides a good explanation and tutorial of how to use coroutine
:
http://marvelopermedia.com/tutorial-coroutines-pt-1-waiting-for-input/.
18.117.73.127