- Home /
variables as GUI
how can i make my number variable as a gui text, without making for example( if the number = 1 then GUI.Label (Rect (100,100,50,50), "1", "box"); if its 2 GUI.Label (Rect (100,100,50,50), "2", "box"); ect) because the numbers will be unlimited, i've tried this script;
var points = 0;
function OnGUI () {
if(points >= 0){
GUI.Label (Rect (100,100,50,50), points, "box");
}
}
but it comes up with errors... how can i make the gui print the var..... thanks for your time!
Comment
Best Answer
Answer by Mike 3 · Apr 01, 2011 at 06:52 PM
It's expecting a string as the second parameter
Try use this:
GUI.Label (Rect (100,100,50,50), points.ToString(), "box");