File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 77#endif
88
99using System ;
10+ using System . Collections ;
11+ using System . Collections . Generic ;
1012using UnityEngine ;
1113
1214using InputKey =
@@ -305,6 +307,31 @@ public static void ClearConsole()
305307 _console . ClearConsole ( ) ;
306308 }
307309
310+ /// <summary>
311+ /// Invoke an enumerator as a Unity coroutine. Useful for commands that may not have a reference to a MonoBehaviour.
312+ /// </summary>
313+ /// <param name="enumerator"></param>
314+ public static void InvokeCoroutine ( IEnumerator enumerator )
315+ {
316+ _console . StartCoroutine ( enumerator ) ;
317+ }
318+
319+ /// <summary>
320+ /// Invoke an action after a specified time has passed. Useful for commands that may not have a reference to a MonoBehaviour.
321+ /// </summary>
322+ /// <param name="action"></param>
323+ /// <param name="delay"></param>
324+ public static void InvokeDelayed ( Action action , float delay )
325+ {
326+ IEnumerator Invoke ( )
327+ {
328+ yield return new WaitForSeconds ( delay ) ;
329+ action ? . Invoke ( ) ;
330+ }
331+
332+ _console . StartCoroutine ( Invoke ( ) ) ;
333+ }
334+
308335 #region Invoke events
309336
310337 internal static void InvokeOnConsoleEnabled ( )
You can’t perform that action at this time.
0 commit comments