Refer to a GUI label drawn on screen in the same script ..

Hi Guys, i want to refer to a GUI.Label which was drawn in the screen in a script. I think i want to give it a Private function name.

The thing i want to actually do is to draw the label in the screen first and take it out at a section, i just need one line of code showing how I could take ir out:)

If I understand correctly, what you want is to set a boolean to toggle the label?

C#

private bool showLabel = true;

void OnGUI()
{
   if (showLabel)
      GUI.Label(...);

   //...
   if (things_happened)
      showLabel = false;
}

UnityScript

var showLabel : bool = true;

function OnGUI()
{
   if (showLabel == true)
      GUI.Label(...);

   //...
   if (things_happened)
      showLabel = false;
}

You can check if things_happened in OnGUI, Update, one of the Collision methods, etc.