public static Coroutine StartCoroutine(this GameObject go, IEnumerator routine)
{
MonoBehaviour mono = go.GetComponent<MonoBehaviour>();
if (null == mono)
mono = go.AddComponent<MonoBehaviour>();
return mono.StartCoroutine(routine);
}
public static void StopCoroutines(this GameObject go, IEnumerator routine)
{
MonoBehaviour mono = go.GetComponent<MonoBehaviour>();
if (null == mono)
mono = go.AddComponent<MonoBehaviour>();
mono.StopCoroutine(routine);
}
public static void StopCoroutines(this GameObject go, string methodName)
{
MonoBehaviour mono = go.GetComponent<MonoBehaviour>();
if (null == mono)
mono = go.AddComponent<MonoBehaviour>();
mono.StopCoroutine(methodName);
}
public static void StopAllCoroutines(this GameObject go)
{
MonoBehaviour mono = go.GetComponent<MonoBehaviour>();
if (null == mono)
mono = go.AddComponent<MonoBehaviour>();
mono.StopAllCoroutines();
}