I think i know what the problem is but when i tried changing the “Lives” of the player back to 3 just before the restart button is pressed it doesnt work. Im probably changing the lives back to the default 3 wrong.
Basicly how my game works is if the lives of the player less than or equal to 0 the game goes to the “game over scene”.
This is how my code looks in MainMenu script.
function OnGUI()
{
//make a group on the center of the screen
GUI.BeginGroup(Rect(Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 175));
//Make a box to see the group on screen
GUI.Box(Rect(0,0,100,175), "Main Menu");
//add buttons for game navigation
if(GUI.Button(Rect(10,30,80,30), "Start Game"))
{
var liveScript = 3;
liveScript = GetComponent("scriptPlayer").lives;
Application.LoadLevel("scene1");
}
and this is how i assigned var lives in scriptPlayer.
static var lives : int = 3;
For some reason this just breaks my “start game” button and doesnt start the game. If anyone could help me it would be much appreciated.