-
-
Save kiranmaya/fb003a68aaeaa2604fee to your computer and use it in GitHub Desktop.
Unity3D WaitThenCallback
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
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