Hey guys, I am trying to build a menu which can be navigated with a custom joystick input.
By default, Unity supports menu navigation with a mouse, or with the arrow/ WASD keys, however, I’m not sure how to get it to work with other inputs- for example the right joystick on a PS4 controller.
I searched for tutorials but can’t find anything about this sort of thing. Any ideas?
By default, Unity UI’s EventSystem has a StandardInputModule. For navigation, this module reads the input axes “Horizontal” and “Vertical”, which are initially mapped to the arrow/WASD keys and the joystick’s main X/Y axes. You can define input axes for the right joystick (e.g., “RightStickHorizontal” and “RightStickVertical”) and tell the StandardInputModule to use them instead of “Horizontal” and “Vertical”.
Thanks so much Tony! Do you know if I can map more than one thing at a time to the Standalone Input Module’s Horizontal axis? for instance something like “Horizontal” || “RightStickAxis” or do I basically have to change it via code at runtime? Sorry for the noob questions I’m still pretty new to this (especially UI)
You can map as much as you want, no need for any code. The Input Manager starts with two mappings for “Horizontal”: the arrow keys and A/D keys, and the joystick’s primary X axis.