- Home /
Question by
Blitzerine · Jul 18, 2011 at 03:01 PM ·
guibuttontogglepop-up
GUI window popup button
how can i put button in place of toogle i want when i click a button a window will popup
// boolean variable to decide whether to show the window or not.
// Change this from the in-game GUI, scripting, the inspector or anywhere else to
// decide whether the window is visible
var doWindow0 : boolean = true;
// Make the contents of the window.
function DoWindow0 (windowID : int) {
}
function OnGUI () {
// Make a toggle button for hiding and showing the window
doWindow0 = GUI.Toggle (Rect (10,10,100,20), doWindow0, "Window 0");
// Make sure we only call GUI.Window if doWindow0 is true.
if (doWindow0)
GUI.Window (0, Rect (100,20,700,350), DoWindow0, "Window 2");
}
Comment
Best Answer
Answer by simonmc · Jul 21, 2011 at 03:20 AM
change the line
doWindow0 = GUI.Toggle (Rect (10,10,100,20), doWindow0, "Window 0");
to
if(GUI.Button(Rect (10,10,100,20),"Window 0")) {
doWindow0 = !doWindow0;
}