What if my customer uses a different controller ?

So I have the shock blue Xbox controller working flawlessly with rumble and all but what if someone plays my game in their computer using a different controller? Like a PS4/5 or switch pro or some generic usb /Bluetooth controller?

I suspect it wouldn’t work as it would with my Xbox controller due to the different mappings. Am I wrong ? If so what would be a way to remedy this? I’m not using any input assets. I configure my Xbox controllers completely on the original unity input system.

bump?

The key is to only go to more specific devices in either mappings or the API when you really need it. Binding to controls on Gamepad will work with anything classified as a gamepad. Binding specifically to controls on XInputController on the other hand will only work with Xbox/XInput controllers.

I see. so what if i want to cater to uses who use ps3/4/5 controllers or other generic gamepads? would I have to deliberately put this options in “controller settings”? I’m hoping i can implement some kind of plug n play system.

I also am trying to avoid using assets like Rewired to implement this. i may not have a choice.

In the new input system, you bind to things like “gamepad’s button south” rather than “xbox controller A button”. That’ll resolve to A on xbox and X on playstation. So then you’re done.

If you use the old input system, you have to check the name of the controller, and then decide which buttons you care about based on that. The old input system’s input manager doesn’t handle that at all (it was never even remotely useful for a real game), so you’d have to build a system around using stuff like if (Input.GetKeyDown(KeyCode.JoystickButton0)). That involves making a mapping for what joystick button 0-20 is on the different platforms, and then converting.

So your choices are:

  • Using the new Input system
  • Buying rewired
  • Doing a couple of weeks of work to get something that probably supports a fraction of the controllers the two first choices do.

Yea it sounds like I may have to go the rewire route to save some headaches lol. I tried the trial and couldn’t get it working. I’ll have to try again with more patience. Thanks!