Last updated: December 14, 2022
This is a comprehensive guide for those wanting to design and implement a robust input system for PC or Console games in Unity. If you follow this guide, your input system will allow for:
The first section, titled ‘Game Design’, describes a framework for designing, organizing, and communicating control schemes with collaborators. The second section, titled ‘Implementation’ will be about implementation itself, and will cover Unity’s Input System Package as well as software architecture (Event Channels). If you are short on time, skip the first section and go straight to ‘Implementation’.
A <Control> (or <Input Control>) are the physical inputs that a player performs on their input device in order to trigger a specific [Action]. Each control is specific to a particular input device, and each input device has a comprehensive list of controls called a control scheme. Multiple <Controls> can be binded to the same [Action]. Also, an individual <Control> can actually be rather complicated; it can require buttons to be held down, control sticks to be in specific positions, or consist of multiple buttons being pressed simultaneously or in sequence. Some <Controls> that the player can perform to play Skyrim on mouse/keyboard are: <W>, <A>, <S>, <D>, <Mouse Delta>, <Spacebar>, <E>, <Left Shift>, <Left Control>, <I>, <Hold R for 1 second>, etc.
An [Action] (or [Input Action]) is a logical input which the player can trigger by performing a <Control>. Once an [Action] is triggered, if certain gameplay conditions are met, a gameplay reaction is triggered. The purpose of [Actions] are to abstract logical inputs from physical inputs, so that you can cleanly decouple gameplay from inputs (making it easy to support multiple input devices, or multiple control schemes). Some [Actions] that can be triggered in a game like Skyrim include: [Move], [Look], [Toggle Walk/Run], [Jump], [Interact], [Sprint], [Toggle Crouch], [Open Inventory], [Toggle Sheathe], etc.