Created
January 13, 2019 04:21
-
-
Save AaronMeyers/fd34e8be87b35df0b4bd712facba12af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections; | |
| using UnityEngine; | |
| public class After : MonoBehaviour | |
| { | |
| static After _instance; | |
| static After instance | |
| { | |
| get | |
| { | |
| if ( _instance == null ) | |
| { | |
| _instance = new GameObject( "After" ).AddComponent<After>(); | |
| _instance.hideFlags = HideFlags.HideAndDontSave; | |
| } | |
| return _instance; | |
| } | |
| } | |
| public static Coroutine Delay( float time, Action action ) | |
| { | |
| return instance.StartCoroutine( instance.DelayRoutine( time, action ) ); | |
| } | |
| IEnumerator DelayRoutine( float time, Action action ) | |
| { | |
| yield return new WaitForSeconds( time ); | |
| action.Invoke(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment