Hello,
I want to change the text of the TextMesh component of a Game Object. I added this script, but it doesn’t work. What’s wrong?
#pragma strict
var scorePoints : int;
function Start () {
}
function Update () {
TextMesh.text = scorePoints;
}
Hello,
I want to change the text of the TextMesh component of a Game Object. I added this script, but it doesn’t work. What’s wrong?
#pragma strict
var scorePoints : int;
function Start () {
}
function Update () {
TextMesh.text = scorePoints;
}
TextMesh.text = scorePoints;
You are calling a static method “text”. If you want change the value of the text component of your object, you can try with the next code:
var scorePoints : int = 5;
var myTextMesh : TextMesh;
function Start()
{
myTextMesh.GetComponent(TextMesh);
}
function Update()
{
myTextMesh.text = scorePoints;
}