Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by shivansh · May 14, 2012 at 01:33 PM · gamesaveloadmain menu

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

GUI Javascript.png (75.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Piflik · May 14, 2012 at 02:10 PM

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

Comment
Add comment · Show 12 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image shivansh · May 15, 2012 at 11:09 AM 0
Share

but I am closing brackets of if statement.

avatar image Lo0NuhtiK · May 15, 2012 at 11:29 AM 0
Share

@shivansh : look closer...


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

((( ...))

avatar image shivansh · May 15, 2012 at 11:35 AM 0
Share

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

avatar image Lo0NuhtiK · May 15, 2012 at 11:37 AM 1
Share

No...     

avatar image shivansh · May 15, 2012 at 11:43 AM 0
Share

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

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges