- Home /
Can you get an axis value without defining a name
I'd like to find the equivalent to Input.GetKey but for an Axis. I want to read in current value of a particular axis without needing to have defined a name for that axis first. I don't see anything like this in the Input class, is it hidden away somewhere else or is that functionality not exposed?
Answer by NPSF3000 · Oct 04, 2010 at 07:36 AM
Don't think this is possible - What is the usage?
I want to be able to define platform specific keymaps. For example, on Windows an XBox 360 controller uses axis 3 for the triggers but on OSX those show up as axis 5 and 6. It would be nice to be able to define in my mapping an axis number for "jump" or such and then do a Input.GetAxisValue(axisNumber) or such. Ins$$anonymous$$d I have to go and define generic names like Axis1, Axis2, Axis3, etc. and associate those with my actions.
Answer by Atnas1010 · Nov 03, 2010 at 01:39 AM
Using two Input.GetKey, you should relatively easily be able to make the equivalent of Input.GetAxisRaw, and the you would only need to apply a little amount of smoothing of your choice.
That's the best I can come up with
I should clarify, a Joystick axis such as the analog sticks on an XBox 360 controller.
Uhm, well I think you can't. But how about defining all the axises you could possibly need in the inputmanager, and then at runtime deciding which ones to use?
Your answer
![](https://koobas.hobune.stream/wayback/20220613074653im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Flight code not reading throttle axis 1 Answer
Why does InputManager have multiple axes with the same name? 1 Answer
Click strategy 2 Answers
Mouse Movements 1 Answer
Controller navigation of UI 1 Answer