I would like to know how to close a GUI.Box with GUI.Buttons? Like in a Pop-up Box. or msgbox in VB6? Is it possible? Thank you in advance!
Every GUI element has to be drawn every OnGUI. If you want something to disappear, just stop drawing it. You can use a boolean variable for this.
private var b_display : boolean = true;
function OnGUI () {
if (b_display)
if (GUI.Button(Rect (10,10,50,50), "hide")) {
b_display = false;
}
}
I haven’t tested that code, but it demonstrates the idea: draw that button (or any GUI elements) if the variable is true, and once the button is clicked stop drawing the button (or group of GUI elements).
thanks! ![]()