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 Unholymess · Mar 05, 2014 at 12:19 AM · token

Unexpected token and expected eof errors in tutorial script space shooter

Hi, working my way through the tutorial and I'm getting loads of errors from the tutorial script (I've tried copy pasting from the tutorial site and still getting the same errors) It was complaining of several missing semicolons which I have added in (I assume this was the correct thing to do and has made the errors go away) but these 2 errors persist: (7,12): BCE0043: unexpected token: float. and (7,18):BCE0044: expecting EOF, found 'xmin'

here is my code:

 using; UnityEngine;
 using; System.Collections;
 
 [System.Serializable];
 public class Boundary
 {
     public float xMin, xMax, zMin, zMax;
 }
 
 public class PlayerController : MonoBehaviour
 {
     public float speed;
     public float tilt;
     public Boundary boundary;
 
     void FixedUpdate ()
     {
         float moveHorizontal = Input.GetAxis ("Horizontal");
         float moveVertical = Input.GetAxis ("Vertical");
 
         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
         rigidbody.velocity = movement * speed;
 
         rigidbody.position = new Vector3 
         (
             Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax), 
             0.0f, 
             Mathf.Clamp (rigidbody.position.z, boundary.zMin, boundary.zMax)
         );
 
         rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, rigidbody.velocity.x * -tilt);
     }
 }

any help would be greatly appreciated.

Comment
Add comment · Show 2
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 Unholymess · Mar 05, 2014 at 12:13 AM 0
Share

for reference, the semi colons that I added were after both instances of the word "using" on lines 1 and 2 and after [System.Serializable] on line 4. I changed these due to the console error saying that there were missing semi colons at these references.

avatar image robertbu · Mar 05, 2014 at 12:21 AM 1
Share

I remove the three ';' you inserted, and the file compiles without errors. I'm not sure what you are seeing. Any chance you put the script in a Javascript file ins$$anonymous$$d of a C# file?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Unholymess · Mar 05, 2014 at 01:24 AM

ohmyfreakinggod, I've just realised that it's a .js extension :/ I am officially an idiot! Thank you for suggesting that!! Can't believe that didn't occur to me :/ It seems to default as a .js in unity when i create a new script, how do I change that?

Comment
Add comment · Show 1 · 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 Unholymess · Mar 05, 2014 at 01:18 AM 0
Share

never$$anonymous$$d, just seen the option to change it. Thank you so much for pointing out where I'd gone wrong!!

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

20 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

Related Questions

Expecting eof found } 1 Answer

I am having a bunch of "invalid token" errors that I don't understand. Help plz -1 Answers

Is there a way to set a unique token variable for each individual Unity client on download? 0 Answers

Unexpected Token: if 2 Answers

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