I just don’t understand it. I used to use guitext and managed to muddle through with that.
I’ve got a canvas, called “Canvas” and a text ui element called “text” – think these are the defaults.
With javascript, I just want to be able to affect the value of the text shown.
How do I do this? I’ve googled and tried to use their examples, but I either get an error of just nothing happens.
Please help. Tearing my hair out over what should be so, so so simple.
Not solved. What I’m trying to do is to find a gameobject (in this case, text with a specifc name in a canvas).
var myDescText : GameObject;
myDescText = GameObject.Find("NotifyText");
// for the purposes of this question, the variable myLitem contains a string "redmist"
// so, with this line, the text of the gameObject called 'NotifyText' should be changed to 'redmist' right?
myDescText.GetComponent <Text> ().text = myLitem;
Except it doesn’t work and spits out 3 errors all pointing to the last line of my code.
These errors are: