using System.Collections;
using UnityEngine;
namespace AriaPlugin.Runtime.Coroutine
{
///
/// This class allows us to start Coroutines from non-Monobehaviour scripts
/// Create a GameObject it will use to launch the coroutine on
///
[DisallowMultipleComponent]
public class CoroutineReciever : MonoBehaviour
{
static private CoroutineReciever m_Instance;
///
///
///
static public CoroutineReciever Instance
{
get
{
if (m_Instance == null)
{
GameObject o = new GameObject ("CoroutineReceiver");
DontDestroyOnLoad (o);
m_Instance = o.AddComponent ();
}
return m_Instance;
}
}
///
///
///
public void OnDisable ()
{
if (m_Instance)
{
Destroy(m_Instance.gameObject);
}
}
///
///
///
static public UnityEngine.Coroutine Notify(IEnumerator coroutine)
{
return Instance.StartCoroutine(coroutine);
}
}
}