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 Devlus · Jan 26, 2011 at 02:57 AM · errorfor-loopsyntax-erroruce0001

Insert a semicolon error

So I hate to post another one of these "missing ;" to this site, but i'm going a little mad staring at my code at the moment. I'd imagine that my Syntax is of on, but i can't find it.

var star : ParticleEmitter;

function OnCollisionEnter(theCollision : Collision) { if(theCollision.gameObject.name == "bullet(Clone)") { Instantiate(star, transform.position, transform.rotation); Destroy(gameObject); } }

function Start() { var i : int = 0;

for(i = 0;i==2;i++) { i=2 Destroy(GameObject); } }

The error is being thrown on the "i=2" line. Thanks in Advance And for some reason the code snippet tool isn't spacing my code right, so i added a blank line myself, sorry if it makes it harder to see, but it looks better than bunched into 3 lines

D

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 Jessy · Jan 26, 2011 at 03:51 AM 0
Share

here isn't anything in your Start function that even begins to make sense. Please create a new version with comments, telling us what you believe the code SHOULD be doing.

1 Reply

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

Answer by Robindoo · Jan 26, 2011 at 03:51 AM

It might be something wrong with your for loop. It should go something like this

for(i = 0; i <= 2; i++)
{
    if(i == 2)
    {
        Destroy(GameObject);
    }
}

Comment
Add comment · Show 3 · 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 Devlus · Jan 26, 2011 at 04:03 AM 0
Share

thanks, i knew it didn't look right, anyway now i just need to figure out how to add to "i" on a collision

avatar image Jessy · Jan 26, 2011 at 01:38 PM 0
Share

Destroy(GameObject) was a big part of the problem. That's suggesting you can destroy the class, GameObject, which is impossible. You most likely want "gameObject". There's no reason to have it in that loop, regardless; just put it afterwards. I do hope you at least have more code in that loop.

avatar image Devlus · Jan 26, 2011 at 11:37 PM 0
Share

what i am doing is making an enemy take 2 hits and then blow up, so yes i do have more script in the loop, and now it is in a collision function. I have no clue what i was thinking with the syntax of my loop though...

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

No one has followed this question yet.

Related Questions

Scripting error: ';' expected. Insert a semicolon at the end. 2 Answers

doing force and spin on a gameobject when clicking on plane. 2 Answers

UCE0001: ';' expected. Insert a semicolon at the end. 2 Answers

Using JavaScript and C# inside one script 2 Answers

help with UCE0001: ';' expected. Insert a semicolon at the end 3 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