Hi I am thirteen years old and am fairly new to unity and have been using java script. I know there is a similar question that someone else has asked but it hasn’t solved my problem.
I am making a fps game and I have made a walking animation for my gun to go up and down as I walk. But the problem is that when I press the ‘w’ key the animation plays but doesn’t stop playing even when you release the ‘w’ key.
here is my script and I would be very grateful if you could help me please.
function Update()
{
if(Input.GetKeyDown("w"))
{
// Plays the walking-m16 animation - stops all other animations
GetComponent.().Play("walking-m16", PlayMode.StopAll);
}
}