Version: 2019.3
Graphics
Physics

Input

Use the Input settings (top menu: Edit > Project Settings, then select the Input category) to define the input axes and game actions for your Project.

Input settings
Input settings

To add more input axes, increase the value in the Size property.

Each input axis provides the following list of properties:

Propiedad: Función:
Name Enter the string that refers to the axis in the game launcher and through scripting.
Descriptive Name Enter a detailed definition of the Positive Button function that appears in the game launcher.
Descriptive Negative Name Enter a detailed definition of the Negative Button function that appears in the game launcher.
Negative Button Enter the name of the button that sends a negative value to the axis.
Positive Button Enter the name of the button that sends a positive value to the axis.
Alt Negative Button Enter the name of the secondary button that sends a negative value to the axis.
Alt Positive Button Enter the name of the secondary button that sends a positive value to the axis.
Gravity Set how fast the input re-centers. This property applies only when the Type is key / mouse button.
Dead Any positive or negative values that are less than this number register as zero. Useful for joysticks.
Sensitivity For keyboard input, a larger value results in faster response time. A lower value is smoother. For the mouse delta, this value scales the actual mouse delta.
Snap Enable this option to immediately reset the axis value to zero after it receives opposite inputs. This property applies only when the Type is key / mouse button.
Invert Enable this option to make the positive buttons send negative values to the axis, and vice versa.
Type Choose what kind of input this axis can expect.
Key / Mouse Button Any kind of button.
Mouse Movement Mouse delta and scrollwheels.
Window Movement User shakes the window.
Joystick Axis Analog joystick axes.
Axis Choose the axis of input from the device (joystick, mouse, gamepad, etc.). Defaults to the X-axis.
Joy Num Choose which joystick should be used. Defaults to retrieving the input from all joysticks.
Note: This is only used for input axes and not buttons.

For further information on naming conventions see documentation on Conventional Game Input.

Using axes during Game Play

All the axes that you set up in the Input settings serve two purposes:

  • They allow you to reference your inputs by axis name in scripting.
  • They allow the players of your game to customize the controls to their liking.

The game launcher presents all defined axes, where it displays the name, detailed description, and default buttons for each. From here, they can change any of the buttons defined in the axes. Therefore, it is best to write your scripts making use of axes instead of individual buttons, as the player may want to customize the buttons for your game.

The game launchers Input settings are displayed when your game runs
The game launcher’s Input settings are displayed when your game runs

For more information see documentation on Input, Input.GetAxis and Input.GetButtonDown in the Scripting Reference.

Graphics
Physics