天天看点

Stop单个Coroutine

public Coroutine StartCoroutine(string methodName, object value = null);

Description

Starts a coroutine named methodName.

In most cases you want to use the StartCoroutine variation above. However StartCoroutine using a string method name allows you to use StopCoroutine with a specific method name. The downside is that the string version has a higher runtime overhead to start the coroutine and you can pass only one parameter.

// In this example we show how to invoke a coroutine using a string name and stop it

function Start () {

}

function DoSomething (someParameter : float) {

using UnityEngine;

using System.Collections;

public class ExampleClass : MonoBehaviour {

jiahuafu

继续阅读