I have a problem with fading scenes. I made an animation that faded and exited, also made a script called Fader , which has a coroutine function. The animation is beautiful. There is also an empty game object called SceneManager , which has a script. In this script function, functions that open the scene are written. 

But the problem is that when I press any button, for example the Scene2 Button , then disappears at the beginning of the animation, on some milliseconds , when a black screen appears, if I click on this black screen, then another scene opens. It will not open scene2 Watch this video
https://drive.google.com/file/d/0B1H5fdK2PJAnbm5fWDhlN3dVVnc
link to the package https://drive.google.com/file/d/0B1H5fdK2PJAnZ2Y1UEFRMmVFbTA
Scene Manager script:
public class Manager : MonoBehaviour { public void GoBackScene1 () { Fader.instance.Perform ("Scene1"); } public void Scene2 () { Fader.instance.Perform ("Scene2"); } public void Scene3 () { Fader.instance.Perform ("Scene3"); } public void Scene4 () { Fader.instance.Perform ("Scene4"); } }
Scene fader script:
public class Fader : MonoBehaviour { public static Fader instance; [SerializeField] private GameObject canvas; [SerializeField] private Animator anim; void Awake(){ makeSingleton (); } public void Perform(string levelname) { StartCoroutine(FadeInAnimation(levelname)); } void makeSingleton(){ if (instance != null) { Destroy (gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } } IEnumerator FadeInAnimation(string level){ canvas.SetActive (true); anim.Play ("FadeIn"); yield return new WaitForSeconds (1f); Application.LoadLevel (level); anim.Play ("FadeOut"); yield return new WaitForSeconds (2f); canvas.SetActive (false); } }
user5663447
source share