x


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!

more ▼

asked Apr 01, 2011 at 06:34 PM

oinkoinkflapflap gravatar image

oinkoinkflapflap
242 156 539 145

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

It's expecting a string as the second parameter

Try use this:

GUI.Label (Rect (100,100,50,50), points.ToString(), "box");
more ▼

answered Apr 01, 2011 at 06:52 PM

Mike 3 gravatar image

Mike 3
32.8k 18 80 290

ah brilliant thanks :)

Apr 03, 2011 at 09:30 AM oinkoinkflapflap
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5628
x1343
x651
x141
x113

asked: Apr 01, 2011 at 06:34 PM

Seen: 2905 times

Last Updated: Apr 01, 2011 at 06:52 PM