Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by chaz1186 · Apr 09, 2016 at 02:12 PM · unexpected-symbol

Can someone Help Me Unexpected Symbol '(' in class, struct ,or interface

So i wrote down this start menu script and it says unexpected symbol '(' and i cant find it can someone please point it out and tell me how to fix it.

 using UnityEngine.SceneManagement;
 using UnityEngine.UI;// we need this namespace in order to access UI elements within our script
 using System.Collections;
 
 public class menuScript : MonoBehaviour
 {
     public Canvas quitMenu;
     public Button startText;
     public Button exitText;
 
     void Start()
 
     {
         quitMenu = quitMenu.GetComponent<Canvas>();
         startText = startText.GetComponent<Button>();
         exitText = exitText.GetComponent<Button>();
         quitMenu.enabled = false;
 
     }
 
     public void ExitPress() //this function will be used on our Exit button
 
     {
         quitMenu.enabled = true; //enable the Quit menu when we click the Exit button
         startText.enabled = false; //then disable the Play and Exit buttons so they cannot be clicked
         exitText.enabled = false;
 
     }
 
     public void NoPress() //this function will be used for our "NO" button in our Quit Menu
 
     {
         quitMenu.enabled = false; //we'll disable the quit menu, meaning it won't be visible anymore
         startText.enabled = true; //enable the Play and Exit buttons again so they can be clicked
         exitText.enabled = true;
 
     }
 
     public void StartLevel() //this function will be used on our Play button
 
     {
     }
 
     public void ExitGame() //This function will be used on our "Yes" button in our Quit menu
 
     {
         Application.Quit(); //this will quit our game. Note this will only work after building the game
 
     }
         SceneManager.loadScene(1)
 }


Comment
Add comment · Show 9
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 chaz1186 · Apr 09, 2016 at 10:13 PM 0
Share

Ok i fixed but it still says '(' is an error please help @gooopil

avatar image gooopil chaz1186 · Apr 09, 2016 at 10:47 PM 0
Share

Post your updated script and the complete error, no way to help you with that little info.

avatar image chaz1186 gooopil · Apr 09, 2016 at 11:30 PM 0
Share

Assets/$$anonymous$$enu Script.cs(52,27): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration

sorry forgot to tag you @gooopil

avatar image chaz1186 · Apr 09, 2016 at 10:55 PM 0
Share

Assets/$$anonymous$$enu Script.cs(52,27): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration

that is the error that is there

avatar image gooopil chaz1186 · Apr 09, 2016 at 11:39 PM 0
Share

O$$anonymous$$ for the error, but do post your code so I don't have to guess!

avatar image chaz1186 gooopil · Apr 09, 2016 at 11:42 PM 0
Share

the code is the one up there in the main post same one didn't do any changes

Show more comments
avatar image chaz1186 · Apr 09, 2016 at 11:42 PM 0
Share

@gooopil tag

avatar image chaz1186 · Apr 09, 2016 at 11:50 PM 0
Share

yeah okay ill get to that lots of thanks for helping you really helped @gooopil

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by gooopil · Apr 09, 2016 at 02:49 PM

Your last line of code :

 SceneManager.loadScene(1)

Is directly in your class, whereas it should be within a method. It's also lacking a semi-column.

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
avatar image
0

Answer by chaz1186 · Apr 09, 2016 at 04:01 PM

within a method? sorry im new at coding i followed an example so it is hard to understand what exactly you mean @gooopil

Comment
Add comment · Show 4 · 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 gooopil · Apr 09, 2016 at 04:20 PM 0
Share

For instance:

  public void ThisIsA$$anonymous$$ethod()
     {
         Scene$$anonymous$$anager.loadScene(1);
     }

https://en.wikipedia.org/wiki/$$anonymous$$ethod_(computer_program$$anonymous$$g)

I'd avise you to read some generic program$$anonymous$$g tutorials, including Object-oriented program$$anonymous$$g tutorials, that will help you a lot!

avatar image chaz1186 · Apr 09, 2016 at 04:26 PM 0
Share

so i put it outside the class

avatar image gooopil chaz1186 · Apr 09, 2016 at 04:30 PM 0
Share

Nope, your methods belong within a class, not outside.

Here's a basic explanation of some principles : https://msdn.microsoft.com/en-us/library/dd460654.aspx

avatar image chaz1186 · Apr 09, 2016 at 04:29 PM 0
Share

can you take the script and fix it please many thanks

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Error CS1525: Unexpected symbol `;', expecting `)', or `,' 1 Answer

Unexpected symbol 'float' 1 Answer

Parsing error and unexpected symbol 1 Answer

What needs to be changed in the coding for it to work again from a tutorial from Aaron Hibberd? 0 Answers

Coding Error 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