Hello,
Below is the short source code:
var buttonPressed : boolean = false;
function OnGUI()
{
if (buttonPressed)
{
GUI.HorizontalSlider(Rect(Screen.width * .5 - 100, Screen.height * .5, 200, 20), 5, -40, 40);
if (GUI.Button(Rect(Screen.width * .5 - 100, Screen.height * .8, 200, 40), "Press Me"))
{
buttonPressed = !buttonPressed;
}
}
else
{
GUI.VerticalSlider(Rect(Screen.width * .5 - 10, Screen.height * .25 - 100, 20, 200), 5, -40, 40);
if (GUI.Button(Rect(Screen.width * .5 - 100, Screen.height * .8, 200, 40), "Press Me"))
{
buttonPressed = !buttonPressed;
}
}
}
My purpose is: vertical slider and 'press me' button shows, after clicking 'press me' button, horizontal slider and 'press me' button shows (vertical slider should disappear), but the vertical slider never disappears.
Thanks.