Game Dev Cheat Sheet

Unity Input Mapping Reference

Keyboard keycodes, gamepad buttons, and mouse inputs with engine-specific code for Unity, Unreal, and Godot.

Input handling is one of the first things you implement in any game, and every engine has different APIs and naming conventions. This reference covers keyboard, mouse, and gamepad inputs with the exact code for Unity (both old Input Manager and new Input System), Unreal Engine, and Godot.

Category:

59 results

Frequently asked questions

Should I use Unity's old Input Manager or the new Input System?
Use the new Input System for any new project. It supports rebinding, multiple devices, action maps, and hot-swapping controllers cleanly. The old Input Manager is simpler for quick prototypes but lacks multi-device handling and is essentially in maintenance mode.
How do I detect a controller button press in Unity?
With the new Input System, define an action of type Button bound to <Gamepad>/buttonSouth (or whichever button), then read action.WasPressedThisFrame() in Update. With the old Input Manager, use Input.GetButtonDown with a button name configured in Project Settings > Input.
Why are my keycodes returning the wrong key?
KeyCodes map to physical keys regardless of layout, so KeyCode.A is always the leftmost letter on a QWERTY board even on AZERTY keyboards. For text-style input that respects the user's layout, use Input.inputString or the new Input System's Keyboard.current.onTextInput.
How do I know which controller a player is using in Unity?
With the new Input System, listen to InputUser.onChange or InputDevice.deviceAdded to detect device hotplug. The active control scheme on each PlayerInput tells you whether the player is on Keyboard&Mouse or Gamepad, which you can use to swap input prompts dynamically.

Last updated: