I’m doing a point system. All im simply wondering is how to convert a int into a string so I wont get a stupid error message. Basicly what im trying to achieve is to take the current score and make the GUItext display it.
So here’s basicly my code.
Can see anything I’m already doing wrong.
static var score = 0;
var scoreDisplay: GUIText;
function Update(){
scoreDisplay.text = score;
}
Use parseint or tostring, check it out in the unity scripting ref
i hope this helps!
You should add some text to the score value (even an empty string) - javascript will convert the score to string automatically:
scoreDisplay.text = ""+score;
scoreDisplay.text = score.ToString();
There’s no need to have that in Update, though. That means you’re constantly updating scoreDisplay.text every frame even when the score hasn’t changed. Make a function that you call when the score changes, instead.