moving in Z axis...

i want to move my character in z axis with downKey keyboard button. but i cannot hold the button to make the player moving continuosly approaching the camera. if press and hold the button, player just forward one step. sorry if i make you confuss with my english… thx

there is the my code :

else if (Input.GetKeyDown (KeyCode.DownArrow))
		{

			velocity.z = -runSpeed;
			_animator.GoToStateIfNotAlreadyThere (Go_front);
		}

as @gif said, without seeing all of your code its kind of hard to help.

But as a quick guess I’d say you don’t have that bit of code in the Update function of your script? Make sure you have your move code in an Update.

:wink:

Without seeing the rest of your code it’s hard to determine if this will work in your if statement.

However to perform that action while the key is held you would need to use Input.GetKey instead of Input.GetKeyDown.

 else if (Input.GetKey(KeyCode.DownArrow))
             {
     
                 velocity.z = -runSpeed;
                 _animator.GoToStateIfNotAlreadyThere (Go_front);
             }