- Home /
GUI.Window Problem Option Menu
I wanted to create a button that when the player clicks on it a GUI.window will appear I tried to create it but it ends up a mess so please can someone help me about this? whenever i click play the window will appear immeadetly
var StartBtn : Texture2D; var Options : Texture2D; var Quit : Texture2D; var show : boolean = false;
public var MyAudio : AudioClip;
function OnGUI () {
if(GUI.Button(Rect(470,250,130,60), StartBtn))
{
audio.PlayOneShot(MyAudio);
Application.LoadLevel("Continue");
}
if(GUI.Button(Rect(470,310,130,60), Options));
{
show = true;
audio.PlayOneShot(MyAudio);
}
if (show) {
GUI.Window (0, Rect (110,10,200,60), ShowWin, "Basic Window");
}
if(GUI.Button (Rect (470, 370,130,60), Quit))
{
(Input.GetKey ("escape"));
audio.PlayOneShot(MyAudio);
Application.Quit();
}
}
function ShowWind (windowID : int) { GUI.Button (Rect (10,30, 80,20), "Click Me!"); }
Answer by KiraSensei · Aug 02, 2014 at 09:22 AM
There is a ";" at the end of
if(GUI.Button(Rect(470,310,130,60), Options));
Delete it !
if(GUI.Button(Rect(470,310,130,60), Options))
{
show = true;
audio.PlayOneShot(MyAudio);
}
And you can ShowWin, but the function is ShowWind. So pick one :)
$$anonymous$$iraSensei thankyou for answering! i think I overlook that errors because I type manually the scripts here because i keep changing everything hahahaah! Im having an internal compiler error this past few days that's why everytime I try this code it dosn't work the Way I want it I reformat my laptop and now it's working! thankyou!! :)) such a great help