IEnumerator Do() { float t = fadeScene.BeginFade(1); yield return(new WaitForSeconds(t)); SceneManager.LoadScene(sceneName); }
// Use this for initialization IEnumerator Start() { while (Input.GetKeyDown(KeyCode.Escape) || !Input.anyKeyDown) { yield return(null); } audioSource.Play(); float fadeTime = fade.BeginFade(1); yield return(new WaitForSeconds(fadeTime)); SceneManager.LoadScene("Main"); }