I get the error message “Assets/Scripts/RespawnMenu.js(28,10): BCE0044: expecting (, found ‘OnGUI’.”
this is my Script
#pragma strict
var LookAround01 : MouseLook;
var LookAround02 : MouseLook;
var charMotor : CharacterMotor;
var sprintScript : SprintAndCrouch;
static var PlayerIsDead = false;
function Start ()
{
LookAround01 = gameObject.GetComponent(MouseLook);
LookAround02 = GameObject.Find("MainCamera").GetComponent(MouseLook);
charMotor = gameObject.GetComponent(CharacterMotor);
sprintScript = gameObject.GetComponent(SprintAndCrouch);
}
function Update ()
{
if (PlayerIsDead == true)
{
LookAround01.enabled = false;
LookAround02.enabled = false;
sprintScript.enabled = false;
charMotor.enabled = false;
}
function OnGUI()
{
if (PlayerIsDead == true)
{
if (GUI.Button(Rect(Screen.width*0.5-50, 200-20, 100, 40),"Respawn"));
{
RespawnPlayer();
}
if (GUI.Button(Rect(Screen.width*0.5-50, 240, 100, 40),"Main Menu"));
{
Debug.Log("Return to Main Menu");
}
}
}
function RespawnPlayer()
{
Debug.Log("Respawn Player");
} }
I also get these errors
Assets/Scripts/RespawnMenu.js(28,17): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Scripts/RespawnMenu.js(43,10): BCE0044: expecting (, found ‘RespawnPlayer’.
Assets/Scripts/RespawnMenu.js(43,25): UCE0001: ‘;’ expected. Insert a semicolon at the end.