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 remoteboxgames · Jun 19, 2015 at 04:13 AM · error messageprogrammingparsing errorunexpected-symbol

Unity always gives me errors

When i write a script no matter what it always says unexpected symbol or parsing error or both but when i remove the symbol it says expecting symbol and the process repeats i tried a different script editor and it still failed! with the parsing error i remove the curly bracket and it gives me expecting symbol { so i don't know what to do can anyone help??

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 revolute · Jun 19, 2015 at 04:35 AM 0
Share

Post your code so that we can help

avatar image Hellium · Jun 19, 2015 at 06:27 AM 0
Share

This kind of error is very common to beginners in program$$anonymous$$g.

You surely have left a semi-colon somewhere or added one in the wrong place (after condition for example, ...)

When you have this kind of problem, start by commenting the entire code of each function. See if the error is still there. Progressively, remove the comments, function by function and see when the error appears. Then, repeat the process with your main "blocks" of code inside your function.

Copy-paste your code as a comment (with the 101010 button), somebody will surely see where the problem is.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Erestyn · Jun 19, 2015 at 07:54 AM

Without seeing your code we can't really say for definite, but when you receive an error like that, it's usually because you've missed a parenthesis/brace/etc, somewhere. You'll usually come across these when you're defining controls eg:

 if (Input.GetKeyDown (KeyCode.UpArrow) {
    // do something
 }

That would return a syntax error ("Unexpected '{'") because I did not close the first parenthesis. In this instance, deleting the character that is reference in the error would result in more syntax errors - exactly as you describe. So the fix would be to close that parenthesis like so:

 if (Input.GetKeyDown (KeyCode.UpArrow)) {
    // do something
 }

My suggestion would be to double check your code and make sure that all brackets, braces etc. are closed, and that all semi-colons are where they should be.

Double click on the stacktrace (the error messages in the console) to be taken directly to the line that's causing the problems.

Edit: As Helium rightly points out, the stacktrace will not always take you directly to the line as I mentioned. Depending on how your code is set up, it could be a few lines above where you've been taken. Be sure to look everywhere for any unclosed braces etc.

Comment
Add comment · Show 2 · 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 Hellium · Jun 19, 2015 at 08:02 AM 1
Share

Be careful, when you are taken to the "line that's causing the problems", the problem is not always where we expect, but sometimes few lines above !

avatar image Erestyn · Jun 19, 2015 at 08:04 AM 0
Share

A very good point, Helium, and one that has caught me out many times in the past... and will evidentally will continue to do so in the future!

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

Multiple Cars not working 1 Answer

Parser Error Unexpected symbol `m_MovementAudio' 1 Answer

Problem with the LOD system 1 Answer

C# Parsing Error 1 Answer

unexpected symbol `public´ 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