如何使用TouchScreenKeyboard访问单个键?我试过了
if (Input.GetKey(KeyCode.A))
UIActions.DebugText("The A Key was pressed!!");
但它没有返回任何东西。这个类似乎只有极少数可用的方法。这样做的正确方法是什么?
using UnityEngine;
public class FullKeyboardUserInput : MonoBehaviour
{
private TouchScreenKeyboard mobileKeys;
void Start()
{
mobileKeys = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false, true);
}
private void Update()
{
if (mobileKeys != null && mobileKeys.done)
{
GameManager.CurrentDriftName = mobileKeys.text;
UIActions.DebugText(GameManager.CurrentDriftName);
UIActions.NumKeyboardView(GameManager.instance.NumKeyboardUserInputView);
Destroy(gameObject);
}
if (Input.GetKey(KeyCode.A))
{
UIActions.DebugText("The A Key was pressed!!");
}
if (mobileKeys != null && mobileKeys.wasCanceled)
{
Destroy(gameObject);
}
}
}
答案 0 :(得分:1)
触摸键盘不是一种输入击键的方式,它是一种输入文字的方式 - 你总是可以使用一个输入字段