- Home /
Scene Fades between but the black screen remains when returning to Previous Screen.
I'm sorry if the title and my explanation feel a bit off, English is not my native language. So I am making a 2d game for android and I have Several scenes like MainMenu, Level Selection, etc etc. I watched Brackeys transition video and did exactly as he said. The Scene fades from one scene to another as expected but the problem starts when I try to get back to any previous screen form where I have faded out. The screen remains black, that is the alpha channel remains at 1.
This is the Script, I use the FadeTo Function in here for the transition. I Have 2 Animation files 'Start' 'End' in End File the screen goes from transparent [alpha = 0] to Solid black [Alpha = 1]
after winning a level the player has a choice to either go to the main menu or go the level selector scene to select a newly unlocked level but as I said before.. once the screen has been faded out from, it stays Solid black if we try to return to it. using System.Collections; using System.Collections.Generic; using UnityEditorInternal; using UnityEngine; using UnityEngine.SceneManagement;
public class FadeAnimationSC : MonoBehaviour
{
public Animator fadeTransition;
public float transitionTime = 1f;
public void FadeTo(string scene)
{
StartCoroutine(fadeAnim(scene));
}
IEnumerator fadeAnim(string scene)
{
fadeTransition.SetTrigger("Start");
yield return new WaitForSeconds(transitionTime);
SceneManager.LoadScene(scene);
}
}
I'd be happy if someone can help me or pin-point me towards a tutorial or an article about the functionality I want. I'd gladly add in additional info if you guys require it. Thanks for your time, I appreciate it!