Hello, I need to find a solution for a situation where there are multiple conditions in a transition and I need to know which one is triggering the transition.
I’m not sure if this is shown somewhere or if this can be accomplished via editor extension.
Thanks in advance
What have to tried so far?
Is this some kind of action beat em up/fighting character controller?
No, it’s a 3D platformer, with many different animations for idle, run, and even jump.
There are also some blend trees
After some research, I have been able to get a print on the console of the condition that is triggering a transition (useful when having multiple conditions).
At first I thought I would need an editor extension, but after a lot of struggling I realized I cold achieve this using a state behaviour.
If you need it, just create a script like this and add it to a state behaviours, then change the parameter of IsUserName to the names you used for your transitions
using UnityEngine;
public class behaviour : StateMachineBehaviour {
//OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
if(animator.GetAnimatorTransitionInfo(layerIndex).IsUserName("c")) Debug.Log("C!");
if(animator.GetAnimatorTransitionInfo(layerIndex).IsUserName("b")) Debug.Log("B!");
if(animator.GetAnimatorTransitionInfo(layerIndex).IsUserName("d")) Debug.Log("D!");
}
}