The documentation states that “for Devices which don’t have specific layouts implemented in the Input System, the system can only surface the information available from the HID descriptor of the Device, which limits how precisely it can describe a control. These Devices often work best when allowing the user to manually remap the controls.”
I’m trying to allow the user to manually remap controls on Devices as suggested above. However, the Input System does not seem to be listening to inputs from unrecognized HIDs, even after manually remapping.
I can successfully use InputAction.PerformInteractiveRebinding() to retrieve the path of a button on an unrecognized HID. For example, when I do this with a DualShock 2 → USB adapter I have, the path is recognized as “<HID::Twin USB Joystick>/button6”, which is what I would expect.
However, after using ButtonAction.ApplyBindingOverride() to bind that path to an action, the action is not recognized as being pressed in the game when I press the button on the device.
This unexpected behavior only happens for unrecognized HID devices. Rebinding actions in this way works fine for my DualShock 4, Xbox 360 controller, etc.
Is there something I’m doing wrong here? Using Unity 2020.3.18f1 with Input System 1.1.1. The “Supported Devices List” is empty in Project Settings.
Is your specific gamepad recognized by other software, e.g. https://gamepad-tester.com/ ?
If it works there, can you also try our Window->Analysis->Input debugger and see if button presses are recognized there correctly? Which USB adapter you have? Thanks!
DualShock 2 and DualShock series is general are not USB HID complaint gamepads, hence why their support can be a little bit of hit and miss, e.g. DualSense HID descriptor is mostly correct, but DualShock 4 has some buttons inverted last time I’ve checked. Switch gamepads usually don’t report HID descriptor at all, and Xbox gamepads go via XInput backend.
However, the device does not seem to be recognized by the Input Debugger in Unity. Screenshot:
To be clear, the DualShock 2 isn’t a USB device. It’s a controller with a proprietary interface used by the PlayStation 2. However, there exist many unofficial DualShock 2 to USB adapters, one of which I am using. The adapter I have looks like this:
Using this adapter, I’m able to use a DualShock 2 controller with various other programs on my PC just fine, but it seems like the Unity Input System isn’t listening to its input for some reason. This is a problem for us as a major hook of our game is that it supports Guitar Hero guitar controllers, and we want to ensure that players will be able to use their PlayStation 2 Guitar Hero controllers via third-party DualShock 2 → USB adapters such as the one I am testing with.
Obviously I don’t expect the Unity Input System to have built-in support for this controller setup, but I would expect it to at least recognize the device and allow for manually mapping its inputs via code (as the documentation suggests).
We would appreciate any help on this. Please let me know if there’s any other information I can provide. Thanks!
Thanks for trying it with 3rdparty website. Would be great if you could report a bug (via Help->Report) bug but also add to it the device descriptors (right click on a device in Input Debugger → Copy device descriptor), it seems that you have 8 of them so guess we will need 8 descriptors, descriptor will be a huge json text blob so just put each in separate text file.
Input system currently has a limited amount of directly supported devices, but we also provide a generic HID support so if any device reports a correctly formed HID we should support it, albeit with need to end user to rebind keys. What is likely happening here is us not recognizing HID report correctly and ignoring it, while operating system / other software recognizes it and it works with gamepad-tester.
Likely the descriptors will suffice, but if not, is this adapter available for purchase somewhere? (you can add that to bug report also). Thanks!
Update: After testing things further, I believe this bug in the Input System is particularly triggered by a specific aspect of how this device works.
The DS2 → USB adapter I am testing has two DualShock 2 ports, left and right. I was only testing with the left port before, which wasn’t working with the Input System. However, I just tested with the right port, and that works with the Input System. Both ports work with gamepad-tester.com though, so I feel that it’s a bug for only one of them to work with the Input System.
My guess as to the cause of this bug would be that it has to do with the fact that each port on this adapter shows up as a separate device, each with the same name (“Twin USB Joystick”), vendorId, productId, etc. However, as you can see in the screenshot above, the Input System is renaming one of them to “Twin USB Joystick1”, but the path I see during the rebinding process I get is “<HID::Twin USB Joystick>/button6”, which doesn’t have that appended “1”. I think the input is probably being lost because of that appended “1”.