Advertisement
Pro_Unit

UnityExtensions_DelayAction

Dec 25th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. public static class UnityExtensions
  2. {
  3.         public static void DelayAction (this MonoBehaviour mono, float timeDelay, System.Action action)
  4.         {
  5.             mono.StartCoroutine(cr_DelayAction(timeDelay,action));
  6.         }
  7.         private static IEnumerator cr_DelayAction (float timeDelay, System.Action action)
  8.         {
  9.  
  10.             yield return new WaitForSeconds (timeDelay);
  11.             if (action != null)
  12.                 action ();
  13.         }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement