Basic button input
Unity includes a standard Input Manager for accessing traditional game controller, keyboard, mouse, and mobile touchscreen input. This can include specific button presses, joystick axes, and the device accelerometer, for example. It also supports input from VR and AR systems.
The Input Manager provides an abstraction layer over the physical input devices. For example, you can reference logical inputs, such as the Fire1
button, which is mapped to a physical button. The mappings for your project can be set up and modified in Edit
| Project Settings
| Input
.
Note
For a general overview and details of Unity Input Manager, see https://docs.unity3d.com/Manual/ConventionalGameInput.html. For scripting the Input class, see https://docs.unity3d.com/ScriptReference/Input.html. Input mapping for various VR devices can be found at https://docs.unity3d.com/Manual/vr-input.html.
Let's take a look. To start, we will write a test script to get a specific button state and see how the Unity...