Skip to content

Instantly share code, notes, and snippets.

@kiranmaya
Forked from mindryu/WaitThenCallback
Created October 27, 2015 16:35
Show Gist options
  • Save kiranmaya/fb003a68aaeaa2604fee to your computer and use it in GitHub Desktop.
Save kiranmaya/fb003a68aaeaa2604fee to your computer and use it in GitHub Desktop.
Unity3D WaitThenCallback
private IEnumerator waitThenCallback(float time, Action callback)
{
yield return new WaitForSeconds(time);
callback();
}
void Start()
{
splashScreen.show();
StartCoroutine(waitThenCallback(5, () =>
{ Debug.Log("Five seconds have passed!"); }));
StartCoroutine(waitThenCallback(10, () =>
{ Debug.Log("Ten seconds have passed!"); }));
StartCoroutine(waitThenCallback(20, () =>
{
Debug.Log("Twenty seconds have passed!");
splashScreen.hide();
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment