- Home /
Question by
mjwrocks · Dec 08, 2013 at 03:11 PM ·
javascriptguitoggle
3 sets of button activations GUI
I'm trying to make a button activate another button, which then once the second button is clicked it will activate the third set of buttons. Thanks for your help in advance.
Here's the current coding in Javascript:
var toggle : boolean;
function OnGUI()
{
toggle = GUI.Toggle(Rect(335, 80, 50, 50), toggle, "Button1", "button");
if (toggle && GUI.Button(Rect(335, 140, 50, 50), "Button2"))
{
// This is the part where I want the second button to activate and show the third set of button(s).
if (toggle && GUI.Button(Rect(335, 140, 50, 50), "Button3"))
{
// Third Button content here.
}
}
}
Comment
Best Answer
Answer by Sundar · Dec 08, 2013 at 04:43 PM
Here you go
var toggle : boolean;
var toggle2 : boolean;
var toggle3 : boolean;
function OnGUI()
{
toggle = GUI.Toggle(Rect(335, 80, 50, 50), toggle, "Button1", "button");
if (toggle)
{
toggle2 = GUI.Button(Rect(335, 140, 50, 50), "Button2", "button");
}
if( toggle2)
{
toggle3 = GUI.Button(Rect(335, 140, 50, 50), "Button3", "button");
}
if (toggle3)
{
// Third Button content here.
}
}