| 123456789101112131415161718192021222324252627282930313233343536 |
- using System.Collections;
- using UnityEngine;
- namespace DunGen
- {
- public sealed class CoroutineHelper : MonoBehaviour
- {
- private static CoroutineHelper instance;
- private static CoroutineHelper Instance
- {
- get
- {
- if (instance == null)
- {
- var obj = new GameObject("DunGen Coroutine Helper");
- obj.hideFlags = HideFlags.HideInHierarchy;
- instance = obj.AddComponent<CoroutineHelper>();
- }
- return instance;
- }
- }
- public static Coroutine Start(IEnumerator routine)
- {
- return Instance.StartCoroutine(routine);
- }
- public static void StopAll()
- {
- Instance.StopAllCoroutines();
- }
- }
- }
|