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

You've got an extra ( before "Player", and no { after the if statement on the same line. You'll also need an extra } at the bottom of the script.

avatar image NoseKills · Jun 12, 2016 at 11:33 AM 0
Share

Unrelated to the original issue var Destructible should be written with a lower case d. You are declaring a variable there and calling Destruct() on it on the next line so use the same case for both.

avatar image ehls39119 NoseKills · Jun 13, 2016 at 12:09 PM 0
Share

I changed the mistake but the same error still shows up

is the script still correct : alt text

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

Thanks, but then these two errors show up:

1.Assets/$$anonymous$$illOnHit.js (6,24) 'is Restarting' is not a member of 'Game $$anonymous$$aster'

2.Assets/$$anonymous$$illOnHit.js (13,19) 'RestartLevel' is not a member of 'Game $$anonymous$$aster'

The script: alt text

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

Dibbie answered the question. Should accept answer.

The new errors are unrelated to the question. Restarting and RestartLevel don't exist in Game$$anonymous$$aster, add them.

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

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

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

Variable Never Used Stopping Game From Running 3 Answers

How can I access an int variable from another script? 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