2
\$\begingroup\$

I've been browsing through Google and researching button inputs in Unity, and I came across this page. When looking at it I noticed that the B button on the Xbox360 controller is set to Button 1, but Button 1 on the PS3 controller is set to X.
On a side-note, I noticed that BlazBlue: Continuum Shift EXTEND on Steam also has this issue when it comes to button inputs as an Xbox360 Controller inputs exactly as shown and a PS3 controller uses Square for Confirm and X for Cancel.
Does this inconsistency in buttons exist and how can I fix this problem so that A=X, B=O, X=Square, and Y=Triangle for my Windows-distributed game if it does? I guess a more appropriate question would be what the button mappings are for PS3 and Xbox360 formatted controllers?

\$\endgroup\$
3
  • \$\begingroup\$ Hook up each controller in turn, and hit all the buttons and find the mapping experimentally. \$\endgroup\$
    – Almo
    Commented Nov 3, 2015 at 19:07
  • \$\begingroup\$ @Almo That doesn't exactly answer my question. I was wondering about cross-platform input for PC games. As Fuzzy Logic mentioned, I would need to utilize something on the Asset Store to get consistency between Xbox360 and PS3 controller inputs. \$\endgroup\$ Commented Nov 3, 2015 at 19:37
  • \$\begingroup\$ @RandomAnimeGamer No, you don't need to get any asset to support both. You do need to map the controllers to actions, rather than relying on the button numbers but you can do that with the builtin Input Manager. The asset is useful but not necessary. \$\endgroup\$ Commented Nov 3, 2015 at 20:31

1 Answer 1

2
\$\begingroup\$

Yes, PS3 controllers are a different configuration than the Xbox controllers. XBox maps to XInput while PS3 is proprietary.

If you treat Button 1 on all joysticks as the fire button, then yes it will be inconsistent. The problem gets even worse if you assume the axis's are the same.

Fortunately, you can map them however you want in Unity's Input Manager. Just don't rely on the ordering of buttons. Map the controllers to actions and then you don't need to worry about if the controllers match or not.

On the downside, if you want to support many different controllers that may have varying configurations, then you may be limited by using the input manager. This isn't a problem though until you have 80 mappings or more than 17 different controller devices to support.

Fortunately, most aftermarket controllers are DirectX compatible, meaning they will conform to the xbox configuration.

In the unlikely event you need to support lots of different devices, you might want to look at Unity Custom Input Manager. It's free, and even if you don't need to support so many devices, it's worth investigating. It lets you do some things that the builtin Input Manager won't. Like modifying the mappings at runtime (EG, let the player customize the mappings in-game).

\$\endgroup\$
5
  • \$\begingroup\$ Thank you for the informative answer to this question! I guess for now I have to stick to using DirectInput and find an asset on the Asset Store to utilize XInput devices. The PS3 devices I was referencing were the Afterglow and PowerA brand controllers. \$\endgroup\$ Commented Nov 3, 2015 at 19:35
  • \$\begingroup\$ XInput is DirectInput. Nearly the same thing. XInput is a newer incarnation of DirectInput. I'm old :) \$\endgroup\$ Commented Nov 3, 2015 at 19:45
  • \$\begingroup\$ Out of curiosity, what was changed between the two? I have a Logitech Controller that has an XInput/DirectInput switch on it and I assumed they were different things at the time. \$\endgroup\$ Commented Nov 3, 2015 at 20:11
  • \$\begingroup\$ DirectInput has less available controls and they are mapped a bit differently, which is why there is a switch. DirectInput is obsolete. You don't need to worry about DirectInput unless you are playing an old game or want to support obsolete controllers. Xbox360 is XInput. Original Xbox is DirectInput. \$\endgroup\$ Commented Nov 3, 2015 at 20:22
  • \$\begingroup\$ One asset you might find helpful for mapping controllers is Rewired assetstore.unity3d.com/en/#!/content/21676 It has a huge range of support for so many controllers and devices. \$\endgroup\$
    – ProtoJazz
    Commented Nov 4, 2015 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .