Unity animator trigger not working as expected,Unity Animator Trigger Being Interrupted

I have a bool (set to true by default) and a trigger for a jump, when I activate the trigger, the trigger immediatly resets and the jump animation does not play and goes back to idle, is this a bug or am i missing something and if this is expected behavior, how can i use this correctly? from reading the documentation this is how I expected it to be used.

here is my code,

void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            animator.SetTrigger("Jump");
        }
}

here is my animator controller layout
transition from any state to idle is if bool is true
transition from idle to jumping is trigger jump

The difference between a bool and a trigger is that a bool has two states while a trigger just activates (“triggers”) and deactivates right after, so it’s natural for it to “immediately reset”.

I guess what is happening here is that because of your Jump animation not having an “exit” transition, it just goes back to Any State as soon as the jump animation is about to start and then straight to Idle state due to the bool not changing it’s value.

You have some options here:

  • Remove the transition from Any State to Idle (which, by the way, can make easier to control the way your animator transitions from one state to another) and make a transition back from Jumping to idle setting the exit time accordingly.

  • Keep it as it is but set your bool to false at the same time you trigger your trigger parameter and, of course, make a transition back from Jumping to idle, otherwise it will keep looping through your Jump animation.