【发布时间】:2019-02-21 23:30:11
【问题描述】:
我有一个统一的简单场景,其中有一个输入字段。当我在我的 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 () {
}
}
【问题讨论】:
-
第一次使用getComponent作为InputField
-
输入 = this.GetComponent
();我在 start 方法中使用了这段代码,但它不起作用