系统键盘
A Unity application can invoke the system keyboard at any time. Note that the system keyboard will behave according to the target platform's capabilities, for example the keyboard on HoloLens 2 would support direct hand interactions, while the keyboard on HoloLens (1st gen) would support GGV1.
Unity应用程序可以在任何时候调用系统键盘。请注意,系统键盘将根据目标平台的能力表现,例如HoloLens 2上的键盘将支持直接的手部交互,而HoloLens(第1代)上的键盘将支持GGV1。
如何调用系统键盘
public TouchScreenKeyboard keyboard;
...
public void OpenSystemKeyboard()
{
keyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false, false);
}
如何读取输入
public TouchScreenKeyboard keyboard;
...
private void Update()
{
if (keyboard != null)
{
keyboardText = keyboard.text;
// 处理keyboardText
}
}
系统键盘示例
您可以在MixedRealityKeyboard.cs
中看到一个如何调出系统键盘的简单示例。