- Home /
KeyCode equivalents to Axis (Joystick)
I need to rewrite Unity's input management system due to Unity's current implementation being too static and generally being poor at handling user binding / multiple player configurations. Being able to detect and bind user button inputs will be simple, since fetching specific button inputs is as simple as calling:
GetKey( Keycode.[Bound Button Here] )
However, there doesn't seem to be an equivalent for Axis. I want to avoid using the InputManager class yet need to find a way to ask specifically for Joystick 1's (or any up to 4) axis state.
Is there a way to fetch Axis information about a specific controller similar to the GetKey method above? Or is there any way generically fetching information about joystick axis?
Answer by Bunny83 · Oct 28, 2014 at 05:48 AM
No, there isn't. The only solution is that you setup a seperate axis in the input manager for every possible axis / joystick combination you want / need to support. Then you can read them as you wish. If you want to support all axes you need to setup only 220 axes :P
Honestly? What a pain...
I suppose I could settle with generic names like "Joystick [0 - 4] Axis [1 - 8]" and make it so that users can bind specific "strings" which represent those in the Unity Input$$anonymous$$anager? That way users can just bind whichever axis they need to / want to use?
I really wish this Input system was better thought out though. $$anonymous$$y experience with SDL2 is actually easier and really blows this system out of the water. Why don't they just use that ins$$anonymous$$d of reinventing the wheel? Idk, their call though.
Well, the input manager has been like this since, well, since i started using Unity years ago ^^ (Started with 2.6). Eric5h5 posted a feature request in 2009. If you haven't already used up your votes, feel free to vote it up ;)
If we could finally access the Input manager via an API, you could define new axes on the fly.
Your answer
![](https://koobas.hobune.stream/wayback/20220613170127im_/https://answers.unity.com/themes/thub/images/avi.jpg)