Skip to content

Instantly share code, notes, and snippets.

@AaronMeyers
Created January 13, 2019 04:21
Show Gist options
  • Select an option

  • Save AaronMeyers/fd34e8be87b35df0b4bd712facba12af to your computer and use it in GitHub Desktop.

Select an option

Save AaronMeyers/fd34e8be87b35df0b4bd712facba12af to your computer and use it in GitHub Desktop.
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