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
0
Question by AirisLoki · Dec 02, 2012 at 10:29 PM · javascripterroreof

expecting EOF, found 'showOptions'

(sorry if this is a stupid question, I'm new) What does it mean when I get a EOF? How do I fix it? #pragma strict

 showOptions : boolean = false;
 function OnGUI () {
     if (GUI.Button (Rect (10,500,150,70), "Multiplayer")) {
 
            Application.LoadLevel(1);
 
     }
     if (GUI.Button (Rect (10,610,150,70), "Quit")) {
 
            Application.Quit();
 
     }
     if (GUI.Button (Rect (10,720,150,70), "Options")) {
     if (showOptions = false) { 
         showOptions = true;
         }
     if (showOptions = true) {
          showOptions = false;
      }
     }
     if (showOptions = true){
     //START THE OPTIONS PAGE
         GUI.Box (Rect (100,10,200,1000), "Graphics Resolution");
         
         if (GUI.Button (Rect (100,40,80,20), "Fastest")) {
        QualitySettings.currentLevel = QualityLevel.Fastest;
     }
     if (GUI.Button (Rect (100,70,80,20), "Fast")) {
        QualitySettings.currentLevel = QualityLevel.Fast;
     }
     if (GUI.Button (Rect (100,100,80,20), "Simple")) {
        QualitySettings.currentLevel = QualityLevel.Simple;
     }
     if (GUI.Button (Rect (100,130,80,20), "Good")) {
        QualitySettings.currentLevel = QualityLevel.Good;
     }
     if (GUI.Button (Rect (100,160,80,20), "Beautiful")) {
        QualitySettings.currentLevel = QualityLevel.Beautiful;
     }
     if (GUI.Button (Rect (100,190,80,20), "Fantastic")) {
        QualitySettings.currentLevel = QualityLevel.Fantastic;
     }
     }
 }
Comment
Add comment · Show 2
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 LightSource · Dec 03, 2012 at 12:20 AM 1
Share

When it says it wants EOF, it means it doesn't want anything there. So Unity is saying showOptions (on whatever line it says you have it on) should not be there. Forgot a semi-colon or a curly bracket maybe?

avatar image Eric5h5 · Dec 03, 2012 at 12:24 AM 1
Share

You will do yourself a huge favor if you format code properly with consistent indentation, so you can easily catch extra (or missing) bracket errors.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by clunk47 · Dec 03, 2012 at 02:07 AM

There are a couple problems here. EOF means "End Of File". Not sure why it was looking for end of file, but what solves this... Instead of

showOptions : boolean = false;

you need to declare that this is a variable, or var. so you would type :

var showOptions : boolean = false;

Another thing wrong with your script, you have IF statements with the wrong "=" sign. When you want to declare something is true or false, you do this = true, or that = false. But if you want to find out if something is equal to something, you use ==, a double equal sign which means "is equal to." so instead of

if(showOptions = true)

you would want

if(showOptions == true)

you could also use

if(showOptions)

or if not equal, you could use a "!" exclamation point in front for "not" like so:

if(!showOptions)

so if(showOptions) is equivalent to if(showOptions == true), or if(showOptions.Equals(true))

and vice versa. if(!showOptions) is equivalent to if(showOptions == false) or if(showOptions.Equals(false))

here is your script with these fixes.

 #pragma strict
 
 var showOptions : boolean = false;
 
 function OnGUI () 
 {
     if (GUI.Button (Rect (10,500,150,70), "Multiplayer")) 
     {
         Application.LoadLevel(1);
     }
     if (GUI.Button (Rect (10,610,150,70), "Quit")) 
     {
         Application.Quit();
     }
     if (GUI.Button (Rect (10,720,150,70), "Options")) 
     {
         if (!showOptions) 
         { 
            showOptions = true;
         }
         else if (showOptions) 
         {
            showOptions = false;
         }
     }
     if (showOptions)
     {
         //START THE OPTIONS PAGE
            GUI.Box (Rect (100,10,200,1000), "Graphics Resolution");
     
          if (GUI.Button (Rect (100,40,80,20), "Fastest")) 
          {
            QualitySettings.currentLevel = QualityLevel.Fastest;
          }
          if (GUI.Button (Rect (100,70,80,20), "Fast")) 
          {
             QualitySettings.currentLevel = QualityLevel.Fast;
          }
         if (GUI.Button (Rect (100,100,80,20), "Simple")) 
         {
            QualitySettings.currentLevel = QualityLevel.Simple;
         }
         if (GUI.Button (Rect (100,130,80,20), "Good")) 
         {
            QualitySettings.currentLevel = QualityLevel.Good;
         }
         if (GUI.Button (Rect (100,160,80,20), "Beautiful")) 
         {
            QualitySettings.currentLevel = QualityLevel.Beautiful;
         }
         if (GUI.Button (Rect (100,190,80,20), "Fantastic")) 
         {
            QualitySettings.currentLevel = QualityLevel.Fantastic;
         }
     }
 }
Comment
Add comment · 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

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

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error BCE0044 plz help 0 Answers

Expecting EOF found '}' (IM SO LOST) 1 Answer

BCE0005: Unknown identifier: 'spriteRenderer'. 2 Answers

Unity freezes when I add a special script 1 Answer

It is not possible to invoke an expression of type 'UnityEngine.GameObject'? 1 Answer


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