The purpose
Troubleshooting note: What to do when gamepad events aren’t firing in Unity’s Input System despite using these settings.

Reason
Joystick
To put the conclusion first, the root cause was that the controller I was using wasn’t actually being recognized as a gamepad.
What I mean by that is Unity was detecting it as a joystick, not a gamepad.
How to confirm
Add a “Player Input” component to any GameObject.
Click “Open Input Debugger”.

Double-click the device you want to check under “Devices”.
Check the “Type”. In the case below, it is a “Joystick”, not a “Gamepad”.

In this case, you need to register Joystick events to the Input System instead of Gamepad.
Even so, the event doesn’t fire.
In my environment (controller), Joystick events aren’t firing even though I’ve registered them.
It seems like Unity’s Input System isn’t receiving any events in the first place.
How to confirm
Open the target device on the Input Debugger just like before.
Scroll down to the Events table and interact with the controller to check if events are being fired.
It seems like some older or cheaper controllers are not supported.
Solution
Since we can’t run tests under these conditions, we will use the Xbox controller emulator (x360ce) to perform the testing here.
Download
Download your preferred version from the following site. (Click on “Assets” and then click on “x360ce.zip”)
The version used in this article is X360CE 4.17.15.0.

Install
To install, simply extract the files to any folder.
Initial settings
Launch the app, select “Controller 1”, and check “Enable 1 Mapped Device”.

When “Issue” on the right highlights, click it.
You may be prompted to install a driver. Additionally, the program might temporarily stop responding after installation; however, restarting your computer should resolve this, and you will find that the driver has been successfully installed.
Next, click “Add” and select the device you want to use from the list provided.
Finally, click “Auto” to automatically set up an optimal button mapping.

If you don’t like the current layout, you can remap the buttons by clicking a button on the controller image and then pressing the button you want to assign to it.
If the XinputControllerWindows device is listed under the Input Debugger, it’s successful.
If it doesn’t appear, try starting (playing) and stopping the game.

Once you close x360ce, the controller stops working. You need to launch x360ce again to use it.

コメント