Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 1.74 KB

File metadata and controls

21 lines (14 loc) · 1.74 KB
uid input-system-user-paired-with-device

Create a user paired with an input device

You can use the InputUser.PerformPairingWithDevice method to create a new InputUser instance and pair it with an InputDevice. You can also optionally pass in an existing InputUser instance to pair it with the Device, if you don't want to create a new user instance.

To query the Devices paired to a specific InputUser, use InputUser.pairedDevices. To remove the pairing, use InputUser.UnpairDevice or InputUser.UnpairDevices.

Initial engagement

After you create a user, you can use InputUser.AssociateActionsWithUser to associate Input Actions to it, and use InputUser.ActivateControlScheme to associate and activate a Control Scheme. You can use InputControlScheme.FindControlSchemeForDevice to pick a control scheme that matches the selected Actions and Device:

var scheme = InputControlScheme.FindControlSchemeForDevice(user.pairedDevices[0], user.actions.controlsSchemes);
if (scheme != null)
    user.ActivateControlScheme(scheme);

When you activate a Control Scheme, the Input System automatically switches the active binding mask for the user's Actions to that Control Scheme.