Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从 UI 中检索文本,InputField但我不确定如何。
InputField
您可以通过首先以某种方式获取对 gameObject 的引用然后从中获取InputField组件并获取组件的text变量来做到这一点:
text
GameObject inputFieldGo = GameObject.Find("PathToTheGameObject"); InputField inputFieldCo = inputFieldGo.GetComponent<InputField>(); Debug.Log(inputFieldCo.text);