I have this script as my animation player:
using UnityEngine;
public class animationPlayer : MonoBehaviour {
public Animation allAnim;
void Update () {
if (Input.GetKeyDown("w") || Input.GetKeyDown("d") || Input.GetKeyDown("s") || Input.GetKeyDown("a"))
{
GetComponent<Animation>().Play("walk");
}
else
{
GetComponent<Animation>().Stop("walk");
}
if (!Input.GetKeyDown("w") || Input.GetKeyDown("d") || Input.GetKeyDown("s") || Input.GetKeyDown("a") || Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown("space"))
{
GetComponent<Animation>().Play("idle");
}
else
{
GetComponent<Animation>().Stop("idle");
}
}
}
But whenever I go into play mode, the walk animation only plays for 7 frames when I press w, a, s or d keys and it is 110 frames long (I know that is long for a walk animation). Can anyone help? I have a video here if it will help: - YouTube