Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 1.34 KB

File metadata and controls

17 lines (10 loc) · 1.34 KB
uid input-system-restrict-binding-resolution

Restrict binding resolution to a specific device

By default, actions resolve their bindings against all devices present that the Input System is aware of (that is, those listed in InputSystem.devices). For example, if there are two gamepads connected, a binding to <Gamepad>/buttonSouth picks up both gamepads and allows the action to be performed from either gamepad.

You can override this behavior by restricting an action asset or individual action maps to a specific set of Devices. If you do this, binding resolution only takes the controls of the specified devices into account.

To restrict an action map to just the first gamepad:

  1. Set the .devices property of the action map to an array containing a reference to the first item in the Gamepad.all array. For example:

    actionMap.devices = new[] { Gamepad.all[0] };

Note

The Input System's user management feature and Player Input component make use of this automatically. They set the InputActionMap.devices for each player automatically, based on the device that is paired to each user.