- Home /
why is my animator transition not working when condition is true
so i have an image, it has 2 animations and the first is the main, the second can only be played if parameter "open" is true. i have 2 scripts which work together to do this, and it does make open true, but for some reason the animation doesnt play.
the first script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class sceneTransfer : MonoBehaviour { // bi is build index for next scene public Button button; public int bi; public transitionControl sc; void Start() { button.onClick.AddListener(trans); } // Update is called once per frame void trans() { Debug.Log("Pressed"); sc.opening(bi); } }
and the second: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class transitionControl : MonoBehaviour { public Animator anim; public float delay = 1f; int b; public void opening(int buildIndex) { Debug.Log("Triggerred"); b = buildIndex; anim.SetTrigger("open"); Invoke("loads", delay); } void loads() { Debug.Log("Wait over!"); SceneManager.LoadScene(b); } }
all the debug.logs are working...
a screen shot of the animator: 
so what is the problem?
OS: Windows, Unity version: 2020.3.13f1, This is an android game
Answer by Kuutioo · Jul 07, 2021 at 09:11 PM
You have to make the line go from transition to transition2 not from Entry to transition2. This is because how would the transition node know anything about the transition2 node if they aren't related to each other in any way.
Your answer