using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class Test : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
public KeyCode GetKeyDownCode()
{
if (Input.anyKeyDown)
{
foreach (KeyCode key in Enum.GetValues(typeof(KeyCode)))
{
if (Input.GetKeyDown(key))
{
Debug.Log(key.ToString());
return key;
}
}
}
return KeyCode.None;
}
private void Update()
{
GetKeyDownCode();
}
}
unity获取键盘按键或鼠标按键名字
最新推荐文章于 2024-07-02 16:09:38 发布