Animator Transition Sometimes Misses Single Frame Inputs

I have a HeroInput class that checks for tapping, holding or double tapping buttons. The checks are all done through Update. I’ve debugged with print to check that the inputs are being picked up correctly by that script.

However, the jump input seems to be getting inconsistently missed by my animator.

I use ‘GetButtonDown’ to find the specific frame to play the animation and apply the upward velocity. The velocities are being applied correctly by my HeroPhysics script, the character is lifting off. However, the Animator is failing to play the jump animation about 1 in 20 times.

I’ve checked print to confirm that jInput is set to 1 for only one update frame, so I can only assume that somehow the Animator is not getting an update on that frame.

Any ideas on how to fix this without holding jInput at 1 an extra frame or two? I’m still new to this so I won’t be surprised if I’m totally wrong about what’s happening.

Here is the relevant bit of script…

void Update ()
    {
        Animator anim = GetComponent<Animator>();
        //Jump Input
        if (Input.GetButtonUp("Jump")) //Stop Jump&Flight
        {
            jInput = 0;
        }
        if (Input.GetButton("Jump"))
        {
            if (Input.GetButtonDown("Jump"))
            {
                if (jCount == 1) //Fly
                {
                    jInput = 3;
                    jCooler = 0.25f;
                    jCount = 2;
                }
                else //Jump
                {
                    jInput = 1;
                    jCooler = 0.25f;
                    jCount = 1;
                }
            }
            else
            {
                jInput = 2;
            }
        }
        //jCooler Reset
        if (jCooler > 0)
        {
            jCooler -= 1 * Time.deltaTime;
            if (jCooler < 0)
            {
                jCooler = 0;
            }
        }
        else
        {
            jCount = 0;
        }
        //Set animator param
        anim.SetInteger("jInput", jInput);
    }

I’m an idiot.

I initially set up the Animator following this tutorial:
https://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers?playlist=17093

It’s a great tutorial, but it has you set up the Animator’s update mode to Animate Physics. That means it only updates animation params during physics calls and fixed update.

So, to anyone else having this problem, if you want to update animation params during Update, make sure your Animator’s update mode is set to normal.