- Home /
 
 
               Question by 
               Rambit · Jan 28, 2013 at 07:49 PM · 
                guibuttononguigui.button  
              
 
              [FIXED] Why is my GUI.Button always pressed?
Hi, I'm really new to coding and I am following a tutorial to learn the basics but have encountered a small problem.
Problem: Button seems to be held down/pressed constantly upon scene load.
Code:
 using UnityEngine;
 using System.Collections;
 
 public class MainMenu : MonoBehaviour 
 {
 
     private string instructionText = "Instructions:\nPress left and right arrows to move.\nPress spacebar to fire.";
     private int buttonWidth = Screen.width / 3;
     private int buttonHeight = 50;
     
     
     void OnGUI () 
     {
         GUI.Label (new Rect(10, 10, 250, 200), instructionText);
         if (GUI.Button (new Rect(Screen.width / 2 - buttonWidth / 2,
                                 Screen.height /2 - buttonHeight / 2, buttonWidth, buttonHeight), "Start" ));
         {
             Debug.Log ("Hey");
         }
     }
 }
 
 
               Does anyone know a fix for this?
UPDATE: I fixed it by removing the semicolon on my if statement.
               Comment
              
 
               
              Your answer