public static CoroutineLoopData StartNew(Action call, IEnumerator theEnum, MonoBehaviour copyObj) { var newObj = new CoroutineLoopData(call, theEnum, copyObj); copyObj.StartCoroutine(theEnum); return(newObj); }
// RunAction AsLoop public static T RunActionAsLoop <T>(this T obj, Action call, float interval, int loops = 0) where T : Component { IEnumerator theEnum = RunLoopTimer(call, interval, loops); MonoBehaviour copyObj = SpawnEmptyMonoObject(string.Format("loopTimerOf_{0}-td{1}", obj.name, corLoopList.Count)); corLoopList.Add(CoroutineLoopData.StartNew(call, theEnum, copyObj)); return(obj); }