How can I get the button press of an Axis?


I would like my script to know if the positive of negative button of an axis is pressed.

So for example:

If a user presses “a” or “d” I can get it’s value (-1 untill 1) by Input.GetAxis(“Horizontal”) and also if the button “a” or “d” is pressed by Input.GetKey(“a”) & Input.GetKey(“d”).

But if a user now changes it’s Horizontal Axis to “g” and “j” Input.GetKey doesn’t work anymore…

That’s why I need to acces the direct positive or negative button of an axis.

There isn’t a way to query which keys are assigned to an axis. So you might be interested in this: