Novel Reader
0
Q:

unity change text

// To change the color of a text, see below
GameObject.GetComponent<Text>().color = Color.black;
7
//Because the Text variable is public, 
//you will have to drag the Text box object onto the script in unity.
//So unity knows what text box to apply the script to.

public Text myText;
myText.text = "Enter the text value here!";

By: Barry Cox
9
// To change text of a text UI element use th combination below
textGameObject.GetComponent<UnityEngine.UI.Text>().text = "text";
8
Text myText = GameObject.Find("Canvas/Text").GetComponent<Text>();
myText.text = "Your text changed!";
-2

New to Communities?

Join the community