How to access keyboard inputs/key presses in your Unity game
Many games will need to receive keyboard inputs for their game to function correctly. Whether it is to shoot or create movement or even special abilities, Unity game engine makes it quite simple for us to accomplish this.
The Input class makes this a rather simple process.
Input.GetKeyDown(KeyCode.Space)
Input.GetKeyUp(KeyCode.Space)
Input.GetKey(KeyCode.Space)
Input.anyKeyDown(KeyCode.Space)
The Unity documentation page for keycode has all of the possible keycodes for input to respond to.
GetKeyDown function will return true when the correct key was pressed.
GetKeyUp function will return true when the correct key was released.
GetKey function will return true when the correct key is held down.
anyKeyDown function will return true when any key is pressed.