MRTK - 无法从 UI_KeyboardInputField 对象获取值

MRTK - can't get the value from UI_KeyboardInputField object

你好,我正在使用 MRTK 2.7.3,我正在尝试从 UI_KeyboardInputField 对象中读取值但我的代码似乎有问题

using Microsoft.MixedReality.Toolkit.Experimental.UI;

public void onSubmit()
{
    GameObject username = GameObject.Find("Username");
    UI_KeyboardInputField inputUsername = username.GetComponent<UI_KeyboardInputField>();
    Debug.Log("username" + inputUsername.Text); <<<ERROR
}

'UI_KeyboardInputField' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'UI_KeyboardInputField' could be found (are you missing a using directive or an assembly reference?)

也许我的方法是错误的我怎样才能从这个字段中获取文本值?

谢谢

来自UI_KeyboardInputField

Only used in Unity 2018.4. No longer used in Unity 2019.3 and later versions (becomes an empty MonoBehaviour and is only around for compatibility) and you can safely remove it if you wish

还有

A component that can be added to InputField to make it work with Windows Mixed Reality's system keyboard.

对我来说听起来像这样 is/was 只是一个用于转发虚拟键盘输入的辅助组件,实际的事情发生在通常的 InputField component attached to the same GameObject and you rather want to access the .text 中。