Android 键盘在统一按下输入字段时不显示?

Ak *_*saf 2 keyboard android unity-game-engine

我有一个简单的统一场景,其中有一个输入字段。当我在 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 () {

    }
}
Run Code Online (Sandbox Code Playgroud)

Ash*_*win 11

无需调用 TouchScreenKeyboard.Open() 方法。如果您在 Unity Remote 应用程序中运行本机键盘,则不会显示本机键盘。但是,一旦您从“文件”>“构建设置”>“构建”或“文件”>“构建并运行”构建并运行应用程序,它将显示在触摸输入字段上。