public static FunctionTimer Create(Action action, float timer, string functionName, bool useUnscaledDeltaTime, bool stopAllWithSameName) { InitIfNeeded(); if (stopAllWithSameName) { StopAllTimersWithName(functionName); } GameObject obj = new GameObject("FunctionTimer Object " + functionName, typeof(MonoBehaviourHook)); FunctionTimer funcTimer = new FunctionTimer(obj, action, timer, functionName, useUnscaledDeltaTime); obj.GetComponent <MonoBehaviourHook>().OnUpdate = funcTimer.Update; timerList.Add(funcTimer); return(funcTimer); }
public static void RemoveTimer(FunctionTimer funcTimer) { timerList.Remove(funcTimer); }