Fade transition won't work in build.
Hi I am having problems with my fading transition when I move to a different scene. The code actually works in the Unity Editor, but when I build and run it, the fader stops working and I just blink to the next scene without the transition. What did I do wrong?
Here is the code:
public class LoadLevel : MonoBehaviour
{
public string words;
public Animator transition;
public bool loadsave;
public void LoadNextNevel()
{
StartCoroutine(Loadlevel());
}
public void LoadSaveLevel()
{
StartCoroutine(Loadsave());
}
IEnumerator Loadlevel()
{
transition.SetTrigger("Start");
yield return new WaitForSeconds(1);
SceneManager.LoadScene(words);
}
IEnumerator Loadsave()
{
transition.SetTrigger("Start");
yield return new WaitForSeconds(1);
SceneManager.LoadScene("FirstLevelEdit");
}
}
Maybe there is something wrong with the Animator state setup, what does transition
look like in the Inspector. Also here is the doc: https://docs.unity3d.com/ScriptReference/Animator.SetTrigger.html
Thank you for your reply, I still haven't found what is wrong yet. Here is an image of the Inspector(btw the script got renamed to "LoadLevelwithMusic"):
Your answer
Follow this Question
Related Questions
Fade between scenes 0 Answers
[SOLVED]Problems loading the scene 1 Answer
Build errors in unity 0 Answers
Unity 5 Survival Shooter Crash 0 Answers
Passing Score from Game Scene to Game Over Scene usiing dontDestroyOnLoad C# 1 Answer