PlayerInput not updating devices after pad is disconnected then reconnected? (247798)

I can start the game with no pads connected, and plug in a pad, it works fine.
But if a pad is disconnected while the game is running, then plugged back in, it does not work.

After some debugging I can see that the pad is re-added to the main list of devices (InputSystem.devices), but is not re-added to my PlayerInput that controls my game. At that point both the device lists in PlayerInput.devices and PlayerInput.user.devices show only the keyboard and mouse, and don’t re-add the pad. When I then push a button on the pad PlayerInput.devices and PlayerInput.user.devices show 0 devices (although the keyboard and mouse still work), and I get 2 IndexOutOfRangeException errors.

Clearly the re-connected device needs to be re-added to my PlayerInput.
Should this happen automatically (like it does if hasn’t been connected before)?
Can I do it manually? If so how?
Please help!! My game comes out soon and I’d like this to be sorted.

2 Answers

2

Anyone?

Is this a bug?
Any help will be appreciated.

This help's me for determine witch device is disconnected or reconnected. I put this code at awake method for registration. I must to create my own List os devices, because unity doesn't update at the moment. I know that this isn't the best way. ``` InputSystem.onDeviceChange += (device, change) => { switch (change) { case InputDeviceChange.Added: myDeviceList.Add(device); break; case InputDeviceChange.Removed: myDeviceList.Remove(device); break; } };

This help’s me for determine witch device is disconnected or reconnected.

I put this code at awake method for registration, an it’s execute when device is changed.

I must to create my own List os devices, because unity doesn’t update at the moment. I know that this isn’t the best way, but i hope that i can help a little bit with this.

InputSystem.onDeviceChange +=
    (device, change) =>
    {
        switch (change)
        {
            case InputDeviceChange.Added:
                myDeviceList.Add(device);
                break;

            case InputDeviceChange.Removed:
                myDeviceList.Remove(device);
                break;
        }
    };