GUI Destroy Label?

Hi, is it possible to destroy a GUI.Label?

Ive tried to put the Gui.label in an variable but theres no variable type GUILabel.

and when I use var test = GUI.Label(...) it gives me the error (Cannot convert void to void).

Thanks

Simply use a boolean so you don't run the GUI.Label code when you don't need it:

if (showLabel) {
    GUI.Label(someRect, "Blah");
}

You can't think of GUI.Label as creating a type. It's probably more accurate to think of it as telling Unity's GUI system to print that label with whatever you pass into it every frame.

So if you need it to change, store off a string to what you want to print, and tell the GUI.Label to print that string instead of hard-coding a particular string.

I got the same problem, my strings was in an array. The value I use was a class member and it always showed the string in position 1. I printed the value used in OnGUI to acces my array and it passed from the right value back to 1. I discovered that it went in fact back to the first nonzero number I initialized my int to.

I solve my problem by setting the member static.

If someone could as an idea as to what was happening…

Hope it helps someone.

Cheers

Edit :
Turns out I had set my script to an object it was not suppose to so I really did have two
Label on my screen…