Exemple #1
0
 public void LoadScene(UnityScene scene, float timeout)
 {
     if (!isStarted)
     {
         StartCoroutine(FadeOut(scene, timeout));
     }
 }
Exemple #2
0
 public void LoadScene(UnityScene scene)
 {
     if (!isStarted)
     {
         StartCoroutine(FadeOut(scene, 0.0f));
     }
 }
Exemple #3
0
        private IEnumerator FadeOut(UnityScene scene, float timeout)
        {
            isStarted = true;

            yield return(new WaitForSeconds(timeout));

            for (float t = 0.0f; t < 1; t += Time.deltaTime / fadeOutTime)
            {
                panel.material.color = new Color(0, 0, 0, Mathf.Lerp(0, 1, t));
                yield return(null);
            }

            SceneManager.LoadScene(scene);
        }