Hi, I am making a first person horror game and I want to make a walking animation for my player. I have created the script and the animation, where the player moves up and down as he walks. The script works fine but when I move, the player just moves up and down. It must be something got to do with the animation. Here’s the script if you need it.
function Update()
{
if(Input.GetKeyDown(KeyCode.W))
{
animation.Play("Walk");
}
if(Input.GetKeyDown(KeyCode.A))
{
animation.Play("Walk");
}
if(Input.GetKeyDown(KeyCode.S))
{
animation.Play("Walk");
}
if(Input.GetKeyDown(KeyCode.D))
{
animation.Play("Walk");
}
}