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 madmax · Dec 16, 2011 at 09:00 PM · errorcompiler

complier Error unexpected char' '.

im typing a code for a sphere to move here is the script:

   var speed: player1 = 3.0 ;
  var rotateSpeed: player1 = 3.0;
  function Update () 
  {
     var controller : CharacterController= GetComponent(CharacterController);
     
     // Rotate around y - axis
     transform.Rotate(0. Input.GetAxis ("horizontal") *  rotateSpeed. 0);
     
     // Move forward / backward
     var forward = transform.TransformDirection(Vector3.forward);
     var curSpeed = speed * Input.GetAxis ("vertical");
     controller.SimpleMove(forward * curSpeed);
  }
 
  @script RequireComponent(CharacterController)
 
  var speed: player1 = 3.0 ;
  var rotateSpeed: player1 = 3.0;
  function Update () 
  {
     var controller : CharacterController= GetComponent(CharacterController);
     
     // Rotate around y - axis
     transform.Rotate(0. Input.GetAxis ("horizontal") *  rotateSpeed. 0);
     
     // Move forward / backward
     var forward = transform.TransformDirection(Vector3.forward);
     var curSpeed = speed * Input.GetAxis ("vertical");
     controller.SimpleMove(forward * curSpeed);
  }
 
  @script RequireComponent(CharacterController)

and it gives me this error:

Assets/move the ball.js(10,28): BCE0044: unexpected char: ' '.

plz tell me what im doing wrong the error is on line 10

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 Eric5h5 · Dec 16, 2011 at 09:58 PM 0
Share

Please format code using the code button.

avatar image madmax · Dec 16, 2011 at 10:19 PM 0
Share

thx both of u

avatar image madmax · Dec 20, 2011 at 02:32 AM 0
Share

thx all of u i fixed it because of you

1 Reply

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

Answer by ByteSheep · Dec 16, 2011 at 09:49 PM

The code is being displayed rather funnily, but I'm guessing each of the numbers declares a line break? In that case the line with the error is:

 transform.Rotate(0. Input.GetAxis ("horizontal") * rotateSpeed. 0);

The "0." after the first bracket and the ". 0" before the end bracket are going to give you errors.. Try this:

 transform.Rotate(Input.GetAxis ("horizontal") * rotateSpeed);

Hope this helps you get past the error and get on with your project..

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 MirrorIrorriM · Dec 16, 2011 at 10:48 PM 3
Share

I agree that the transform.Rotate line is the problem. But I think that the problem is because ins$$anonymous$$d of writing

transform.Rotate(0, Input.GetAxis ("horizontal") * rotateSpeed, 0);

he wrote

transform.Rotate(0. Input.GetAxis ("horizontal") * rotateSpeed. 0);

I think you just need to change the "."'s to commas and it would work.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Shader error in ... : Syntax error at line 30 1 Answer

Android SDK Root Folder 3 Answers

Internal Compiler Error, caused by System.Windows.Forms.dll 1 Answer

Internal Compiler Error 1 Answer

error issues : KeyNotFoundException 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