Unity 检测遥控器对键盘映射的那些按键

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;


public class NewBehaviourScript : MonoBehaviour {


// Use this for initialization
void Start () {

}
  //  keyc
    public Text t;
// Update is called once per frame
void Update () {
        if (Input.anyKeyDown)
        {
            foreach (KeyCode keyCode in Enum.GetValues(typeof(KeyCode)))
            {
                if (Input.GetKeyDown(keyCode))
                {
                      t.text = "Current Key is : " + keyCode.ToString();
                }
            }
        }


        if (Input.GetKeyUp(KeyCode.Escape))
        {
            Application.Quit();
        }
}




}

你可能感兴趣的:(Unity)