float y = Input.GetAxis("Vertical"); 2D code example Example: unity input get axis float movement = Input.GetAxis("Horizontal") * speed;