I’m trying to make a menu for my game using GUI buttons, I followed the instructions at :Unity - Manual: Controls and put code in to be used once the button is clicked, the problem i’m having is that when i start my game it will open normally and after about half a second it will trigger the code for when I click the button, without me clicking them.
#pragma strict
private var Options : boolean;
var OptionsGUI : GameObject;
var MenuGUI : GameObject;
function OnGUI()
{
if(GUI.Button(Rect(175, 210, 400, 75),"O P T I O N S"));
{
SetOptions();
}
}
function SetOptions ()
{
//this code is what i'm using to switch between GUI i tested it and it works
OptionsGUI.GetComponent(options).enabled = true;
MenuGUI.GetComponent(menu).enabled = false;
}