Map Unity Keycodes to Android KeyEvents


Is it possible to map the standard Unity KeyCodes to Android KeyEvents?

I want to add support for a Bluetooth Android Game Controller, and the controllers documentation specifies Android KeyCodes (Ex. KEYCODE_BUTTON_X for the button X).
Is it possible to tell if this KEYCODE_BUTTON_X is the same as JoystickButton1 on the Unity side?

As I understand each Android KeyEvent has it’s constant integer value, can this be somehow translated to a Unity Keycode?

Note: I don’t have the physical device so I can’t connected and see which of the inputs are triggered.

Thanks in advance,


Hmmm… It’s kind of a shot in the dark.
You can try Input.GetJoyStick

or maybe "Input: "+(string)Input.inputString

But without a device I’m not sure… :frowning:

I have an adroid phone but not a controller or anything so I can’t test any of these for you.

I know you can get the int value by converting it over…


returns 278 for example…

(int)KeyCode.A = 97 …

As far as the values being similar, I don’t think there is any correlation.

Considering I believe KEYCODE_A = 29 on some devices…

Nevermind, here is what you are looking for mapping android

"FireTV Button Unity KeyCode

Up Arrow KeyCode.UpArrow

Down Arrow KeyCode.DownArrow

Center Button KeyCode.JoystickButton0"