- Home /
Save/ Load game script in main menu
I want to create a saving and loading script so that my users can enjoy and can pause the game for a while. But I have a problem coming up in my script:
var OptionUI = false;
enum Mode {Easy =2}
function Update ()
{
}
function OnGUI()
{
GUI.Box(Rect(Screen.width /2 - 60,Screen.height /2 - 179,120,340, "Main Menu"));
if(OptionUI == false)
{
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 120,109,39, "Play Game"))
{
Application.LoadLevel(1);
}
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 90,109,39, "Options"))
{
OptionUI = true;
}
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 60,109,39, "Exit"))
{
Application.Quit();
}
}
if(OptionUI = true)
{
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 50,109,39,"Easy"))
{
}
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 50,109,39,"Medium"))
{
}
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 50,109,39,"Hard"))
{
}
}
}
125![alt text][1]125
Error is: Assets/GUI.js(16,9): BCE0044: expecting ), found '{'.
(Filename: Assets/GUI.js Line: 16)
Assets/GUI.js(20,9): BCE0044: expecting ), found '{'.
(Filename: Assets/GUI.js Line: 20)
Assets/GUI.js(24,9): BCE0044: expecting ), found '{'.
(Filename: Assets/GUI.js Line: 24)
Assets/GUI.js(26,9): BCE0044: expecting EOF, found '}'.
(Filename: Assets/GUI.js Line: 26) Thank you in advance if you can help me!!! I beg you!!!Help me!!
[1]: http://unity3d.qatohost.com/storage/temp/912-GUI+Javascript.png
Answer by Piflik · May 14, 2012 at 02:10 PM
You are not closing the brackets of your if statements...
@shivansh : look closer...
if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 50,109,39,"Hard"))
((( ...))
can you send me a script for saving and loading the game.. Please!!!
why??? please... I have tried the thing you said but then there came a huge list of errors.... I put in the 3 brackets at last but then again error... I am sick of it... Please help me!!!
Your answer
Follow this Question
Related Questions
Drag and Drop menu and Save load game. 0 Answers
Save Game - What do I need? 1 Answer
Unity load last level (save and load game) 0 Answers
Save and Load Game 2 Answers
Load last checkpoint from main menu 2 Answers