using System.Collections;
using UnityEngine;
namespace TriLibCore
{
///
/// Represents a class used to dispatch coroutines.
///
public class CoroutineHelper : MonoBehaviour
{
private static CoroutineHelper _instance;
///
/// Gets the coroutine helper instance.
///
public static CoroutineHelper Instance
{
get
{
if (_instance == null)
{
_instance = new GameObject("Coroutine Helper").AddComponent();
_instance.hideFlags = HideFlags.DontSave;
}
return _instance;
}
}
///
/// Runs an enumerable method.
///
/// The method to run.
public static void RunMethod(IEnumerator enumerator)
{
while (enumerator.MoveNext())
{
}
}
private void OnDestroy()
{
_instance = null;
}
}
}