如何从UI.InputField获取文本? [英] How to get Text from UI.InputField?
本文介绍了如何从UI.InputField获取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用Unity,
刚开始我想要从UI输入字段中的文本,但不能这样做,
请帮忙。
I have just Started using Unity, I want to retrieve the text from UI Input Field but unable in doing so, Please help.
推荐答案
您可以通过先获得参考游戏物体不知何故然后让从它 InputField
组件,并采取组件的<$做C $ C>文本变量:
You can do it by first getting reference to the gameObject somehow then getting the InputField
component from it and taking the component's text
variable:
GameObject inputFieldGo = GameObject.Find("PathToTheGameObject");
InputField inputFieldCo = inputFieldGo.GetComponent<InputField>();
Debug.Log(inputFieldCo.text);
这篇关于如何从UI.InputField获取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文