Animation loop issue

Ok so when i auto attack everything works except for when the Float Attack is changed to 4.0 the character does not revert back to the idle animation like its rigged to in the animator

additionally when the attack is changed to 9 the animation for the attack does not play again even though 4 seconds is way more than enough time for this to happen

i checked the animator and float is changing when its suppose to to but the animation does not play.

at this point i cant figure out what is stopping that from happening

the animations them selfs are not configured to loop but to my understanding every time a animation transition is triggered it should repeat?

using UnityEngine;
using System.Collections;
using System;

public class Player1 : Creature
{
    bool combatstate;
    public int waittime;
    public static Player1 player;

    public static bool isAttacking;

    public static Transform opponent;
    public Animator attackanimaton;

    // Use this for initialization
    void Awake()
    {
        player = this;
        isAttacking = false;
        combatstate = false;

    }

    // Update is called once per frame
    void Update()
    {
        attackanimaton = GetComponent<Animator>();
        isAttacking = false;
        attacksuccess();
    }

    IEnumerator AutoAction()
    {
        if (combatstate == true)
        {

            if (opponent != null && Vector3.Distance(opponent.position, transform.position) < range)
            {

                Debug.Log("is attacking");
                attackanimaton.SetBool("isAttacking", true);
                attackanimaton.SetFloat("Attack", 9.0f);
                opponent.GetComponent<Enemy>().GetHit(damage);
                yield return new WaitForSecondsRealtime(4.0f);
                attackanimaton.SetFloat("Attack", 4.0f);
                Debug.Log("waiting");
                yield return new WaitForSecondsRealtime(4.0f);
                StartCoroutine(AutoAction());



            }

        }
    }

    void attacksuccess()
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            Debug.Log("combatstate is D");
            combatstate = !combatstate;
            StartCoroutine(AutoAction());
        }
    }

    protected override void Attack()
    {
        throw new NotImplementedException();
    }
}

Hi Resilo,

Are you using a blend tree for attack? If so the state would remaim the same and no transition occur. Therefor your non-looping animations would finish.

If you are not using a blend tree I would hazard a guess that the problem lies in the transition conditions between the nodes in your Animator controller. Using floats to change between different attack animations strikes me as peculiar. Im not currently at my computer but If I remember correctly there are only greater than and less than conditions for floats. So you couldnt say transition when Attack equals 4.

Could you supply an image of how your Animator controller nodes are setup? Im speculating at this point.

Kind Regards,

thanks for the input i got it to work you were right it was an attack tree issue thanks for verifying for me