Animator just triggering one of the existing animations

18 views Asked by At

I'm using three existing animations from mixamo. I've set them up by using the state parameter, and I've double checked that all transitions are as they should be.

I've attached this basic script to the player to test the different animations:

public class AlienMoves : MonoBehaviour {

private Animator anim;

private enum MovementState { idle, climbing, jumping }


// Start is called before the first frame update
private void Start()
{
    anim = GetComponent<Animator>();
}

// Update is called once per frame
private void Update()
{
  
    UpdateAnimationState();

}

private void UpdateAnimationState()
{
    MovementState state;

    if (Input.GetKeyDown("escape"))
    {
        state = MovementState.climbing;
      
    }
    else if (Input.GetMouseButtonDown(1))
    {
        state = MovementState.jumping;
        Debug.Log("Should be jumping");
    }
    else
    {
        state = MovementState.idle;
    }


    anim.SetInteger("state", (int)state);
}

}

I have two problems; the first being that each time I test the animations by pressing keys they don't display the whole animation(Fixing the duration time in the editor doesn't resolve this, it only makes it last longer). The second problem is that there's only one of the animations being triggered, even though I'm pressing different keys. I've checked that this is accurate by watching the animator whiles testing, it's only moving back and forth from the dance(default) animation and one of the others.

I'm thinking it might be something with the mixamo files I've imported because I can't seem to find out what's going on. If anyone has any ideas that would be appreciated :D

0

There are 0 answers