• 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 ehls39119 · Jun 12, 2016 at 09:56 AM · error messagevariablesvarjavascriptingfound

What do I do when This error shows up ?

Please Help ! What Do I Do when t$$anonymous$$s ERROR shows up :

Assets/KillOnHit.js(8,9): BCE0044: expecting), found 'var'.

From the Series of MAKE A GAME (By Brackeys) Video 22

The script : alt text

screen-shot-2016-06-12-at-54139-pm.png (93.8 kB)
Comment
Add comment · Show 3
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 Mmmpies · Jun 12, 2016 at 10:21 AM 0
Share
avatar image NoseKills · Jun 12, 2016 at 11:33 AM 0
Share
avatar image ehls39119 NoseKills · Jun 13, 2016 at 12:09 PM 0
Share
screen-shot-2016-06-13-at-80818-pm.png (97.0 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Dibbie · Jun 13, 2016 at 12:24 PM

Youd want to update your code to the following:

 if (colInfo.tag == ("Player")){
 var destructible = colInfo.GetComponent ("Destructible") as Destructible;
     destructible.destruct();
     }

Your main issue is, after ("Player"), you dont have a closing brace ) for your if-statement - as well I noticed you also dont have a starting curly brace { for your if-statement either. Now taking a second look, you also technically dont have an ending curly brace } for that if-statement either, so your code will run and the error will go away once you add that closing brace ) - but you probably wont get the results you expected - when you dont specify curly braces with if-statements, it will only read the following line under it, as the "if statement", so only line 8 is considered a part of the if-statement to line 7, and like 9 is considered part of line 6's if-statement.

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 ehls39119 · Jun 13, 2016 at 01:42 PM 0
Share
screen-shot-2016-06-13-at-93644-pm.png (94.0 kB)
avatar image Jessespike ehls39119 · Jun 13, 2016 at 05:52 PM 0
Share

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Variable changing from other script does not work. 1 Answer

Cant Change lighting/scene variables,Cant Change Lighting Properties 0 Answers

Prefabs holding variables,How to carry accross game objects to prefabs 1 Answer

Use of unassigned local variable 'startPos' " & " Use of unassigned local variable 'endPos' 1 Answer

Browser Error: Window function is not a function when called from WebGL JavaScript plugin 0 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