using System.Linq; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { public Text m_KeyCode; public Text m_Horizontal; public Text m_Vertical; void Start() { m_KeyCode.text = "KeyCode: "; } void Update() { var allKeys = System.Enum.GetValues(typeof(KeyCode)).Cast(); foreach (var key in allKeys) { if (Input.GetKeyDown(key)) { Debug.Log(key); m_KeyCode.text = "KeyCode: " + key.ToString(); } if (Input.GetKeyUp(key)) { m_KeyCode.text = "KeyCode: "; } } float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); m_Horizontal.text = "Horizontal: " + h.ToString(); m_Vertical.text = "Vertical: " + v.ToString(); } }