How to correctly pair InputUsers with Devices ?

I’m trying to pair a GamePad with a user. I’m making something like this

void Awake()
{
InputUser newUser = InputUser.CreateUserWithoutPairedDevices();
        newUser = InputUser.PerformPairingWithDevice(Keyboard.current, newUser, InputUserPairingOptions.None);
        newUser = InputUser.PerformPairingWithDevice(Mouse.current, newUser, InputUserPairingOptions.None);
        newUser = InputUser.PerformPairingWithDevice(Gamepad.all[0], newUser, InputUserPairingOptions.None);
}

But when I go to the InputDebugger Tab → Users → User#0 it only has mouse and keyboard paired

Are you sure that Gamepad.all[0] exists? This code works fine on my machine when a gamepad is connected.

1 Like