public static Coroutine StartSafeCoroutine(this MonoBehaviour behav, IEnumerator work)
 {
     if (behav != null && behav.isActiveAndEnabled)
     {
         if (CoroutineRunnerObj != null && !CoroutineRunnerObj.activeInHierarchy)
         {
             Object.Destroy(CoroutineRunnerObj);
             CoroutineRunnerObj = null;
         }
         if (!CoroutineRunnerObj)
         {
             CoroutineRunnerObj           = new GameObject();
             CoroutineRunnerObj.hideFlags = HideFlags.HideAndDontSave;
             Object.DontDestroyOnLoad(CoroutineRunnerObj);
         }
         if (!CoroutineRunnerBehav)
         {
             CoroutineRunnerBehav = CoroutineRunnerObj.AddComponent <CoroutineRunnerBehav>();
         }
         var info = new CoroutineInfo()
         {
             behav = behav, work = work
         };
         return(info.coroutine = behav.StartCoroutine(SafeEnumerator(work, info)));
     }
     return(null);
 }
 public static Coroutine StartCoroutine(this IEnumerator work)
 {
     if (CoroutineRunnerObj != null && !CoroutineRunnerObj.activeInHierarchy)
     {
         Object.Destroy(CoroutineRunnerObj);
         CoroutineRunnerObj = null;
     }
     if (!CoroutineRunnerObj)
     {
         CoroutineRunnerObj           = new GameObject();
         CoroutineRunnerObj.hideFlags = HideFlags.HideAndDontSave;
         Object.DontDestroyOnLoad(CoroutineRunnerObj);
     }
     if (!CoroutineRunnerBehav)
     {
         CoroutineRunnerBehav = CoroutineRunnerObj.AddComponent <CoroutineRunnerBehav>();
     }
     //if (work is IDisposable)
     {
         var info = new CoroutineInfo()
         {
             behav = CoroutineRunnerBehav, work = work
         };
         return(info.coroutine = CoroutineRunnerBehav.StartCoroutine(SafeEnumerator(work, info)));
     }
     //else
     //{
     //    return CoroutineRunnerBehav.StartCoroutine(work);
     //}
 }