我想从UI检索文本 InputField 但我不知道怎么做。
InputField
您可以先获取对gameObject的引用,然后获取 InputField 从中提取组件并获取组件的 text 变量:
text
GameObject inputFieldGo = GameObject.Find("PathToTheGameObject"); InputField inputFieldCo = inputFieldGo.GetComponent<InputField>(); Debug.Log(inputFieldCo.text);