InputManager doesn't detect gamepad numbers correctly

I have a split-screen local multiplayer game. Each connected controller receives a split-screen, so that controller 1 is the upper left corner, controller 2 is the upper right corner, etc.

Lets say I have three 360 gamepads connected to a Windows PC. One through direct USB connection, the other two through the wireless receiver (if it matters).

In InputManager, I have all of the input mappings setup like so

  • Horizontal0
  • Shoot0
  • Jump0
  • Horizontal1
  • Shoot1
  • Jump1
  • etc…

So that the 360 controller marked at controller 1 would correspond to input mappings 0 and control the upper left screen, controller 2 would correspond to input mappings 1 and control the upper right screen, etc.

The problem I’m facing is that often (though not always) Unity will recognize the second 360 controller (I say second, because the upper right light ring is lit on the controller) as controller 1, and thus controls the player in the upper left corner split-screen, instead of the upper right corner split-screen as expected.

Is this just a known Unity quirk? Are there any known workarounds so that Unity always properly respects the controller numbers?

After some time, I can answer my own question.

This appears to be a common issue as reported here and unfortunately, there’s no true solution.

My solution has been to use XInputDotNet instead of the built-in Unity InputManager which I can attest fixes the issue. Problem with that, it uses DirectX which means Windows only.

There’s also XboxCtrlrInput which attempts to create a more multi-platform solution, using XInputDotNet on Windows and seemingly falling back to Unity’s built-in InputManager for all other platforms.