Hello, Im currently attempting to make a script so when i click a gui button then a list of songs appear. And if i click one of those songs i want it to play it. But its not working the way i want it to. Here is my script.
var Song1 : AudioClip;
var Song1WasPressed = false;
var showMoreGui = false;
function OnGUI ()
{
if (GUI.Button (Rect (10,10,100,20), "Show More"))
{
showMoreGui = true;
}
if (showMoreGui)
{
if(GUI.Button (Rect (10, 40,100,20), "Song1"));
{
Song1WasPressed = true;
}
if (GUI.Button (Rect (10, 70,100,20), "Close"))
{
showMoreGui = false;
}
}
}
function Update()
{
if(Song1WasPressed)
{
audio.clip = Song1;
audio.Play();
}
}
Thanks for any help!!