0
\$\begingroup\$

So, according to some documentation I found, the Xbox controller on Mac does not return Dpad presses as vertical/horizontal axes:

enter image description here

As you can see, the Dpad is only recognized as buttons 5, 6, 7, and 8, and not as horizontal/vertical axes. For my character's movement, I just created code that returns 1 or -1 for axis depending on the button pressed. It works perfectly fine. But then I found another problem: UI navigation.

I can't navigate my menus with the Dpad on Mac because the the EventSystem is expecting navigation via horizontal/vertical axes, which the Dpad is not providing.

Is there any way I can turn these Dpad button presses into real horizontal/vertical axes in Unity's Input system? Or is there something else I can do to make UI navigation happen on a Mac, with the Dpad?

\$\endgroup\$
3
  • \$\begingroup\$ Does assigning these buttons as the positive & negative buttons of an axis in the Input Manager, the same way the defaults are set up for the keyboard arrow keys, not work in this situation? \$\endgroup\$
    – DMGregory
    Commented Aug 31, 2017 at 9:57
  • \$\begingroup\$ @DMGregory That does work, it completely slipped my mind, thank you. It does, however, introduce an issue where the specified buttons "overlap" with those of other platforms. "joystick button 7" is Dpad for left, but on Windows it's also the Start button. I'm not sure how to get around this. \$\endgroup\$
    – Andrio
    Commented Sep 1, 2017 at 0:32
  • \$\begingroup\$ Myself, I usually create two copies of the Input Manager data file and manually swap them out based on the platform I'm building for. There are very likely more robust solutions through. ;) \$\endgroup\$
    – DMGregory
    Commented Sep 1, 2017 at 0:42

0

You must log in to answer this question.

Browse other questions tagged .