AnimatorTransitionInfo.IsName() Not Working

I’m trying to find out when a specific transition is happening but no luck.

Here’s the code:

public Animator anim;

if(anim.GetAnimatorTransitionInfo(0).IsName("LOCOMOTION -> JUMP"))
{
	Debug.Log("jump transition");
}

I only have 1 layer so that’s not the problem and the argument is based on the format example provided in the unity references (“CURRENT_STATE → NEXT_STATE”).

I have also tried every combination of I could think of including “BASE_LAYER.LOCOMOTION->BASE_LAYER.JUMP”.

Can any one help?

Hi, i had the same problem.

First, you probably need to change “Transition Duration” in Inspector Debug menu to some bigger number. (First I had 0 then I changed it to 0.2 and it worked).

Then, the format should look like this.
Here is my code:

print (anim.GetAnimatorTransitionInfo(0).IsName(“Base Layer.idle → Base Layer.walk”));