A variable inside a GUI.Button if statement changes to true when I start my game without the button being pressed. I am sure that this is the button that is doing this because I have checked and anything inside it activates. I’ll give you my script and any info would be appreciated!
var texture : Texture;
static var started = false;
function OnGUI ()
{
if (!started)
{
if (GUI.Button (Rect (450, 300, 100, 100), texture));
{
started = true;
}
}
}
function Update ()
{
print (started);
if (started)
{
gameObject.Find ("Image").SetActive (false);
}
}
When the game starts up, started is true but then goes to false the next frame without me pressing the button. GUI.Button works fine in another script I made, it’s really weird!