using System.Linq; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { public Text m_Text; void Start() { m_Text.text = ""; } void Update() { var allKeys = System.Enum.GetValues(typeof(KeyCode)).Cast(); foreach (var key in allKeys) { if (Input.GetKeyDown(key)) { Debug.Log(key); m_Text.text = key.ToString(); } if (Input.GetKeyUp(key)) { m_Text.text = ""; } } } }