1110319 鍵盤代碼 KeyCode 用法
by 黃國哲 2022-03-19 15:46:37, Reply(0), Views(482)
https://docs.unity3d.com/ScriptReference/KeyCode.html
宣告這個變數
public KeyCode keycode;可以讓按鈕物件和鍵盤的實體按鈕直接做連結
void Update () {
//Keypresses. The keycode is stores in the ButtonSetup class
if(Input.anyKeyDown){
foreach(Transform t in buttonHolder.transform){
if(Input.GetKeyDown (t.gameObject.GetComponent.keycode) ){
t.gameObject.GetComponent < Butto >().OnPointerClick (
new UnityEngine.EventSystems.PointerEventData(UnityEngine.EventSystems.EventSystem.current));
Reply