i seem to have a simple logic error. i’m trying to attach a 2d audio clip to a slider to control the volume but i’m having no luck. the slider is being created after a press of the button here is my code :
var buttonPressed = false;
var volume : float = 0.0;
var musicslider : float = 0.0;
audio.volume = musicslider;
function OnGUI () {
if (GUI.Button (Rect (300, 200, 80, 40), "volumeControl"))
{
buttonPressed = true;
}
if(buttonPressed == true)
{
musicslider = GUI.HorizontalSlider (Rect (300, 200, 100, 40), musicslider, 1.0, 10.0);
}
else{
}