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 /
avatar image
0
Question by Firezebra · Jul 13, 2017 at 08:53 PM · javascriptuce0001semicoloninsert

';' Expected, Tried everything. How do I do this?

UCE0001 ';'. Insert a semicolon at the end.

JavaScript

var OnTriggerEnter(Collider) { AddScore(int) { SumScore.Add(_int); } }

Comment
Add comment · Show 1
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 Jinkata · Jul 13, 2017 at 09:07 PM 0
Share

What are you trying to do here? Don't take this the wrong way, but your code makes no sense. Are you trying to define functions you can call or call already defined functions within the OnTriggerEnter method.

Looks like you should probably brush up on JavaScript basic program$$anonymous$$g and syntax. I would recommend you scrap JS and move to C# though.

1 Reply

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

Answer by Hotshot10101 · Jul 13, 2017 at 09:23 PM

You need to start the line with function not var.

From the documentation here is an example:

 // Destroy everything that enters the trigger

 function OnTriggerEnter (other : Collider) {
     Destroy(other.gameObject);
 }
Comment
Add comment · Show 6 · 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 Firezebra · Jul 13, 2017 at 09:28 PM 0
Share

Thanks! It worked.

avatar image Hotshot10101 · Jul 13, 2017 at 09:30 PM 0
Share

You are welcome.

avatar image Firezebra · Jul 14, 2017 at 01:40 AM 0
Share

Hey sorry to bug you again, but I am getting this error again now

function OnTriggerEnter(Collider) { return addScore(int) { SumScore.Add(_int) { Destroy(other.gameObject); } }

avatar image Kishotta Firezebra · Jul 14, 2017 at 01:48 AM 0
Share

You keep trying to define functions inside other functions. $$anonymous$$eep in $$anonymous$$d this is NOT javascript, but unityscript, which only looks like javascript.

You need to create a seperate AddScore function.

 function AddScore (increment : int) {
     SumScore.Add (increment);
 }
 function OnTriggerEnter (other : Collider) {
     AddScore (/*Whatever score goes here*/);
 }
avatar image Firezebra Kishotta · Jul 14, 2017 at 02:30 AM 0
Share

Tried it, fixed that problem, I now have an unknown identifier

Show more comments

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

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

; expected insert semicolon at the end 2 Answers

js(9,31): UCE0001: ';' expected. Insert a semicolon at the end. 2 Answers

UCE0001: ';' expected. There is one there? 1 Answer

UCE0001 error Insert a Semicolon at end 1 Answer

UCE0001: ';' expected. 2 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