unity change text via script with variable code example
Example: unity how to change text in script
Text myText = GameObject.Find("Canvas/Text").GetComponent<Text>();
myText.text = "Your text changed!";
Text myText = GameObject.Find("Canvas/Text").GetComponent<Text>();
myText.text = "Your text changed!";