StopCoroutine

Stops all coroutines for the specific method name running on this behavior.

Tip

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;
  }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.70.170