I have setup a very simple animation for a scene transition fade out / fade in.
The animation themselves work.
If I click the trigger while in play mode, it works.
If I call the “SetTrigger” API, it does not work.
The default transition (FadeIn) does actually work.
void Start()
{
anim = GetComponent<Animator>();
}
public void LoadScene()
{
StartCoroutine(Transit());
}
IEnumerator Transit()
{
anim.SetTrigger("FadeOut");
yield return new WaitForSeconds(anim.GetCurrentAnimatorClipInfo(0).Length);
SceneManager.LoadScene(NextScene);
}
SceneManager.LoadScene(NextScene); is called and works, only the “SetTrigger” does not.
If you have any idea what could go wrong, I would be interested.
As a side note, I was using Unity 2019.3.12f1 when I first started to setup this transition animation.
Nothing was working at all, I could not even see the Animator transition screen. Lost hours trying to understand what I was doing wrong. In the end I was not doing anything wrong.
Upgrading to Unity 2019.3.13f1 solved this part of the issue.
(Earlier this year I also add issues with the animator, and again it was a bug in the specific Unity version I was using at the time).
