var myAudio;
myAudio = GetComponent(AudioSource);
private var scrollVol : float = 0.5;
function AudioSwitch ()
{
if(!myAudio.playOnAwake)
{
myAudio.Play();
myAudio.playOnAwake=true;
}
else
{
myAudio.Stop();
myAudio.playOnAwake=false;
}
}
function OnGUI()
{
if(myAudio.playOnAwake)
{
scrollVol = GUI.HorizontalSlider (Rect (150,175,100,20), scrollVol, 0.0, 1.0);
myAudio.volume = scrollVol;
}
}