【发布时间】:2018-11-24 11:25:26
【问题描述】:
如何使用 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);
}
}
}
【问题讨论】:
标签: c# iphone unity3d keyboard