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 DavidJess · Dec 15, 2014 at 03:40 AM · varradiustokenunexpected-token

Unexpected Token Error

The error is:

Assets/placePickups.js(8,18): BCE0043: Unexpected token: 2.

  #pragma strict
     var objectToCreate : Transform;
     var radius : int;
     
     
     function Start () {
     
         **for (var 1 : int = 0;1 < 5; 1++)**
         {
             var randWithinCircle = Random.insideUnitSphere * radius;
             var pickUp = Instantiate (objectToCreate, Vector3(936 + randWithingCircle.x, 8, 1080 + radWithinCircle.z), Quaternion.identity) as GameObject;
         }
     }



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 DavidJess · Dec 15, 2014 at 03:48 AM 0
Share

yes these are scripts that I was given to use as a handout from my lecturer. ik they are correct and they work so i have made a mistake somewhere but can seem to work it out. since this the only program$$anonymous$$g I done.

1 Reply

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

Answer by MrSoad · Dec 15, 2014 at 03:44 AM

Are these ** actually in your script, they should not be there. Or are you trying to use these to highlight the problem?

Did you mean :

 for (var i : int = 0; i < 5; i++)

not :

 for (var 1 : int = 0;1 < 5; 1++)

Lastly you never give the radius var a value just a type(int). This var needs a value. It's type would also be better as float not int.

Comment
Add comment · Show 5 · 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 DavidJess · Dec 15, 2014 at 03:53 AM 0
Share

alt text

That is what i was given there.

untitled.jpg (205.4 kB)
avatar image DavidJess · Dec 15, 2014 at 03:55 AM 0
Share

you feel like such an idiot when it staring you in the face......

yh i had the letter i as a numeric 1.

sorry...

avatar image MrSoad · Dec 15, 2014 at 03:58 AM 0
Share

No problem, I edited my answer above with a bit more info that should also be of use :)

avatar image DavidJess · Dec 15, 2014 at 04:01 AM 0
Share

thanks for all the help.

i got to hand this game in to him in like 5 hrs :P so tht just the last script :P

avatar image MrSoad · Dec 15, 2014 at 04:03 AM 0
Share

Cool, good luck! Don't forget to accept an answer when your question is answered :D

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Unxepected token: Var (Please Help) 1 Answer

Var Error Help 1 Answer

Expecting eof found } 1 Answer

Import Variables from another active script 1 Answer

Help me with this Unexpected token error 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