- Home /
Question by
KIXOStudios · Jun 15, 2016 at 06:19 AM ·
c#uiinputtext
Display user Input to a text UI element.
Hello, I currently have the following script on a GM object in my scene.
public GameObject text;
private Text txtRef;
void Awake () {
txtRef = text.GetComponent<Text>();
}
void Update () {
txtRef.text = "A string.";
}
I then have a text UI element assigned to the 'text' gameObject. The text in this is then changed to "A string." by the line 'txtRef.text = "A string.";' though I was wondering how I could display the words that a user types into the screen, just like a program such as notepad++ or pastebin does. I've had a look on the internet but all I can find is threads regarding changing the text like I've done below, I need the user to change the text by what they type in.
Thanks in advance.
Comment