using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using TMPro; using UnityEngine; public class MyTest : MonoBehaviour { TextMeshProUGUI testrrr; void Start() { } void Update() { // 判断是否有按键按下 if (Input.anyKeyDown) { // 遍历 KeyCode 枚举,找到按下的键 foreach (KeyCode kc in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(kc)) { Debug.Log("按下的键:" + kc.ToString()); break; } } } } public void OnDown() { } }