public static void SwitchScene(string sceneName) { var globalFader = Fader.CreateGlobalFader(); UnityEngine.Object.DontDestroyOnLoad(globalFader); globalFader.faderState = Fader.FaderState.FadingIn; globalFader.onFadeIn += () => { SceneManager.LoadScene(sceneName, LoadSceneMode.Single); globalFader.faderState = Fader.FaderState.FadingOut; }; globalFader.onFadeOut += () => { UnityEngine.Object.Destroy(globalFader.gameObject); }; }