function OnGUI () {
if(some condition) txt = GUI.TextField (Rect (450, 210, 200, 20), txt, 25);
}
Hi there 
I love unity but sometimes is makes me sad
How can I disapper or destroy such a field? I want game to ask for a password then one part of menu is clicked, if player decide not to enter the password the field should thisappear… I dont know how to tag it or destroy or whatever… pls help me
thanks and cheers:)
I think that all you have to do is to display it and not to display it because the OnGUI function is called every frame. For example,
private var display: boolean = false;
private var txt: string;
function OnGUI ()
{
//condition to set the display variable
display = true;
if (display == true)
{
txt = GUI.TextField (Rect (450, 210, 200, 20), txt, 25);
}
}
private var display : boolean = false;
private var txt : String = “your pass goes here”;
function OnMouseDown () {
print(this.tag);
if(this.tag == “private”) display = true;
if(this.tag != “private”) display = false;
}
function OnGUI () {
if(display==true) txt = GUI.TextArea (Rect (450, 210, 200, 20), txt, 25);
}
In that case gui WILL NOT disappear
Ok, maybe some other beginner can use that tip. If you wanna do such a thing you should create some empty gameObject to display GUI
thats all