I created a gui button to load level once the button is pushed because the code I was using before automatically clicked the button and loaded the level without any actual clicking of the button. So I changed my code to this.
var playGame = GUI.Button;
function Start () {
}
function Update ()
{
if(Input.GetButtonUp ("GUI.Button")); //check to see if button is clicked
Application.LoadLevel (1); //load first level when button is released
}
var customSkin : GUISkin;
function OnGUI() {
var buttonW : int = 100;//button width
var buttonH : int = 50;//button height
var halfScreenW = Screen.width /2; //half the screen width
var halfButtonW = Screen.height /2; //half the button width
var halfScreenH = Screen.height/1.5; //half the screen height
GUI.skin = customSkin;
GUI.Button(Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Play Game!");
}
This is the error that I am currently getting.
nityException: Input Button GUI.Button is not setup.
To change the input settings use: Edit → Project Settings → Input
TitleGui.Update () (at Assets/Scripts/TitleGui.js:11)
Any help would be greatly appreciated.