How do use sense when a left or right arrow key is pressed?

Forum Archive How do use sense when a left or right arrow key is pressed?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6585
    Godfrey Thompson
    Participant
      #25610
      Jonathan Gonzalez
      Participant

        The arrow keys can be used with the “Horizontal” or “Vertical” axis based off the input manager if you want to keep things fairly open ended. If you want to see how these values change with the arrow keys you can add a debug.log in the update method:

        void Update{

        Debug.Log (“Horizontal ” + Input.GetAxis (“Horizontal”) + ” Vertical ” + Input.GetAxis(“Vertical”));

        }

        To check if these are pressed use “Input.GetAxis(“Horizontal”)” or “Input.GetAxis(“Vertical”)”, the vertical is for the up and down arrow keys, while horizontal is for the left and right arrows. 

        #25611
        Godfrey Thompson
        Participant

          I want to sense if the left or right arrow key is pressed.

          I think it is somthing like: Input.GetKeyDown(“”)

          But I dont know what to put in the “”.

          #25612
          Nicholas Yang
          Participant
          Viewing 4 posts - 1 through 4 (of 4 total)
          • The topic ‘How do use sense when a left or right arrow key is pressed?’ is closed to new replies.