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();
}
Great Post! Get Free Upvotes ! http://ity.im/CHE7E
Congratulations @pangcola! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP