I poked around with the joystick settings and found pretty much all of the buttons. The buttons in the center are for system use, so they seem not to be mapped.
See attached zip for .cs and InputManager.asset as a plain text. Of course, for OnGUI you’ll need to have a GUI Layer on your camera!
NOTE: Make sure that your axis names match those listed here in your Input Manager. Otherwise you won’t get any axis input. Use the InputManager.asset in the zip in a test project. Please don’t overwrite your InputManager.asset file in a project you’re working on without a backup!
Okay. Notice the peculiarities: buttons 6 & 7 are skipped; axes 9, 10, & 11 are skipped; axis 12 is a duplicate of 8, axis 13 is a duplicate of 7. Peculiar.
using UnityEngine;
using System.Collections.Generic;
//Testing Android TV ADT-1 gamepad
// thelackey3326
public class InputTest : MonoBehaviour
{
private Dictionary<KeyCode, bool> m_JoystickButtons = new Dictionary<KeyCode, bool>();
private Dictionary<string, float> m_JoystickAxes = new Dictionary<string, float>();
void Start()
{
m_JoystickButtons.Add(KeyCode.JoystickButton0, false);
m_JoystickButtons.Add(KeyCode.JoystickButton1, false);
m_JoystickButtons.Add(KeyCode.JoystickButton2, false);
m_JoystickButtons.Add(KeyCode.JoystickButton3, false);
m_JoystickButtons.Add(KeyCode.JoystickButton4, false);
m_JoystickButtons.Add(KeyCode.JoystickButton5, false);
m_JoystickButtons.Add(KeyCode.JoystickButton8, false);
m_JoystickButtons.Add(KeyCode.JoystickButton9, false);
m_JoystickAxes.Add("Joystick Axis X", 0.0f);
m_JoystickAxes.Add("Joystick Axis Y", 0.0f);
m_JoystickAxes.Add("Joystick Axis 3", 0.0f);
m_JoystickAxes.Add("Joystick Axis 4", 0.0f);
m_JoystickAxes.Add("Joystick Axis 5", 0.0f);
m_JoystickAxes.Add("Joystick Axis 6", 0.0f);
m_JoystickAxes.Add("Joystick Axis 7", 0.0f);
m_JoystickAxes.Add("Joystick Axis 8", 0.0f);
m_JoystickAxes.Add("Joystick Axis 12", 0.0f);
m_JoystickAxes.Add("Joystick Axis 13", 0.0f);
}
void Update()
{
m_JoystickButtons[KeyCode.JoystickButton0] = Input.GetKey(KeyCode.JoystickButton0);
m_JoystickButtons[KeyCode.JoystickButton1] = Input.GetKey(KeyCode.JoystickButton1);
m_JoystickButtons[KeyCode.JoystickButton2] = Input.GetKey(KeyCode.JoystickButton2);
m_JoystickButtons[KeyCode.JoystickButton3] = Input.GetKey(KeyCode.JoystickButton3);
m_JoystickButtons[KeyCode.JoystickButton4] = Input.GetKey(KeyCode.JoystickButton4);
m_JoystickButtons[KeyCode.JoystickButton5] = Input.GetKey(KeyCode.JoystickButton5);
m_JoystickButtons[KeyCode.JoystickButton8] = Input.GetKey(KeyCode.JoystickButton8);
m_JoystickButtons[KeyCode.JoystickButton9] = Input.GetKey(KeyCode.JoystickButton9);
m_JoystickAxes["Joystick Axis X"] = Input.GetAxis("Joystick Axis X");
m_JoystickAxes["Joystick Axis Y"] = Input.GetAxis("Joystick Axis Y");
m_JoystickAxes["Joystick Axis 3"] = Input.GetAxis("Joystick Axis 3");
m_JoystickAxes["Joystick Axis 4"] = Input.GetAxis("Joystick Axis 4");
m_JoystickAxes["Joystick Axis 5"] = Input.GetAxis("Joystick Axis 5");
m_JoystickAxes["Joystick Axis 6"] = Input.GetAxis("Joystick Axis 6");
m_JoystickAxes["Joystick Axis 7"] = Input.GetAxis("Joystick Axis 7");
m_JoystickAxes["Joystick Axis 8"] = Input.GetAxis("Joystick Axis 8");
m_JoystickAxes["Joystick Axis 12"] = Input.GetAxis("Joystick Axis 12");
m_JoystickAxes["Joystick Axis 13"] = Input.GetAxis("Joystick Axis 13");
}
void OnGUI()
{
GUILayout.BeginArea(new Rect(50.0f, 50.0f, Screen.width - 50.0f, Screen.height - 50.0f));
GUILayout.BeginHorizontal();
{
GUILayout.BeginVertical(GUILayout.Width(200.0f));
{
foreach (KeyValuePair<KeyCode, bool> buttonState in m_JoystickButtons)
{
GUILayout.Label(buttonState.Key.ToString() + ": " + buttonState.Value.ToString());
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(GUILayout.Width(200.0f));
{
foreach (KeyValuePair<string, float> axisState in m_JoystickAxes)
{
GUILayout.Label(axisState.Key + ": " + axisState.Value.ToString());
}
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
}
1747848–110432–AndroidTV_InputTest.zip (1.31 KB)