UGUI文本输入
using UnityEngine;
using UnityEngine.UI;
public class TestInput : MonoBehaviour {
private Text _text;
private InputField _inputField;
void Start () {
_text = GameObject.Find("Text").GetComponent<Text>();
_inputField = GameObject.Find("InputField").GetComponent<InputField>();
}
void Update () {
_text.text = _inputField.text;
}
}
直接 .text即可获得输入的字符串。