我在 unity 中有一个简单的场景,其中有一个输入字段。当我在我的 Android 设备中运行我的场景并按下输入字段时,android 键盘不显示。我使用 Unity Remote 5 应用程序通过 USB 连接到我的笔记本电脑。
这是我的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class InputNumber : MonoBehaviour {
public InputField input;
// Use this for initialization
void Start () {
if (input)
{
TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, true);
}
input.keyboardType = TouchScreenKeyboardType.NumberPad;
}
// Update is called once per frame
void Update () {
}
}
最佳答案
无需调用 TouchScreenKeyboard.Open() 方法。如果您在 Unity Remote 应用程序中运行 native 键盘,则不会显示 native 键盘。但是,一旦您从文件 > build设置 > 构建或文件 > 构建并运行构建并运行应用程序,它就会显示在触摸输入字段中。
关于统一按下输入字段时,Android 键盘不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52997407/