Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
Created June 6, 2012 09:46
Show Gist options
  • Select an option

  • Save AngryAnt/2880988 to your computer and use it in GitHub Desktop.

Select an option

Save AngryAnt/2880988 to your computer and use it in GitHub Desktop.
Stab at easing the delayed invoke of whatever (untested).
void InvokeDelayed (Action action, float seconds)
{
StartCoroutine (DoInvokeDelayed (action, seconds));
}
IEnumerator DoInvokeDelayed (Action action, float seconds)
{
yield return new WaitForSeconds (seconds);
action ();
}
// Use
InvokeDelayed (() => { ShootAtAllOfTheThing (withThis, andThat, alsoThisOne); }, 1.0f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment