x


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!!

GUI Javascript.png (75.6 kB)
more ▼

asked May 14 '12 at 01:33 PM

shivansh gravatar image

shivansh
-5 1 1 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You are not closing the brackets of your if statements...

more ▼

answered May 14 '12 at 02:10 PM

Piflik gravatar image

Piflik
5.4k 15 26 44

but I am closing brackets of if statement.

May 15 '12 at 11:09 AM shivansh

@shivansh : look closer...


    if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 50,109,39,"Hard"))

((( ...))

May 15 '12 at 11:29 AM Lo0NuhtiK

can you send me a script for saving and loading the game.. Please!!!

May 15 '12 at 11:35 AM shivansh

No...     

May 15 '12 at 11:37 AM Lo0NuhtiK

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!!!

May 15 '12 at 11:43 AM shivansh
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x803
x438
x437
x41

asked: May 14 '12 at 01:33 PM

Seen: 688 times

Last Updated: May 15 '12 at 12:10 PM