what i want to do is create a slider in place of where a button was or next to the button. what i was trying to do was create the slider inside the button but when clicked would not create the slider. anyone know how to do this? any help would be appreciated. my code looks like this:
Ok. The problem here is that the ‘GUI.Button’ function returns ‘true’ only on the exact frame that it gets pressed! The reason why your slider isn’t appearing is because it is appearing for exactly one frame, and then disappearing again.
If you want the volumeControl button to disappear permanantly and get replaced by the ‘SliderForMusic’ slider, you could do this-
var buttonPressed = false;
function OnGUI()
{
if(buttonPressed)
{
// draw the slider!
// maybe also draw a button that sets 'buttonPressed' to false again
} else {
buttonPressed = GUI.Button (Rect (300, 200, 80, 40), "volumeControl");
}
}