Mecanim animation transitions behaving sporadicly

We were using this tutorial, https://community.mixamo.com/hc/en-us/articles/204581427-Tutorial-Mecanim-Advanced-Animation , to help us set up our characters movement backwards using the sub-state machine.

however when the button is pressed (in our case the third mouse button), the animation keeps transitioning very fast over and over again, sometimes all 3 animations play at once. Then decides to work properly, which is when the button is pressed down or held down the character stays in the apporite (“TurtleBack”) state until the button is pressed again.

Why would mecanim be behaving this way?

Plz, help were are stuck.

Howdy, can I see your code and transition properties for your animation states?

Ok, here it is:

Animation code Part 1:

if (Input.GetKey(KeyCode.Mouse2))
        {
            Debug.Log ("Start moving Turtle Backwards");

            Turtle.MovePosition(Turtle.position - backVelocity * Time.unscaledDeltaTime);
            //Debug.Log("player is moving backwards");

            TurtlePlayer.SetFloat("TurtleSpeed",BackVelocity);
            //Debug.Log("player's speed animation is set");
        }

        else if (Input.GetKeyUp(KeyCode.Mouse2))
        {
            TurtlePlayer.SetBool("TurtleSwimNow",true);
            //print ("I'm A transitioning Turtle");
           
            StartCoroutine(TurtleSwimNow());
        }

        //Moves player forward on X-axis
        if (Input.GetKey(KeyCode.Mouse1)) {

            Turtle.MovePosition(Turtle.position + velocity * Time.unscaledDeltaTime);
            TurtlePlayer.speed = 2;

            StartCoroutine (TurtleSwimReset());
        }

Animation code Part 2:

IEnumerator TurtleSwimNow ()
    {
        TurtlePlayer.SetBool("TurtleSwimNow", true);
        //Debug.Log ("player's animation bool is true, start to transition");
       
        yield return longWait;

        TurtlePlayer.SetBool("TurtleSwimNow", false);
        //print ("I'm Swimming Normally Now");

        StartCoroutine (TurtleAnimationReset ());
    }

The transitions:

Transition 1:

Swimming turtle player to Turtle swim back:

Transition 2:

Turtle Swim Back to Turtle Back to normal:

Transition 3:

Turtle Back to Normal to Swimming Turtle Player:

Howdy, I assume this code exists inside an Update function. With that information, the line KeyCode.Mouse2 is going to be evualated many, many times a second. More than likely, that is your problem. Consider using GetKeyDown instead. On that note, the code StartCoroutine (TurtleSwimReset(); will be called many times as well. This will start that coroutine many times a second and will probably cause many problems as well. Again, consider reworking your code so that you can use GetKeyDown instead.

While, we tested using get keydown and get keyup still the same results. Also we had some strange behavior, somehow the set bool for false was still being called even though I commented out the start coroutine. Leading into that infinite loop we keep seeing.

if (Input.GetKeyDown(KeyCode.Mouse2))
        {
            Debug.Log ("Start moving Turtle Backwards");

            Turtle.MovePosition(Turtle.position - backVelocity * Time.unscaledDeltaTime);
            //Debug.Log("player is moving backwards");

            TurtlePlayer.SetFloat("TurtleSpeed",BackVelocity);
            //Debug.Log("player's speed animation is set");
        }

        else if (Input.GetKeyUp(KeyCode.Mouse2))
        {
            TurtlePlayer.SetBool("TurtleSwimNow",true);
            //print ("I'm A transitioning Turtle");
           
            //StartCoroutine(TurtleSwimNow());
        }

Is there any other relevant code that you haven’t listed here? That isn’t a behavior that should be occurring.

No, none relevant to setting the parameters in mecanuim that I know of. Should I send the whole script regarding the player?