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 noah · May 08, 2011 at 06:38 AM · errorsyntax-erroruce0001

whats wrong wrong with my script

it keep saying this Assets/Standard Assets/NewBehaviourScript.js(7,43): UCE0001: ';' expected. Insert a semicolon at the end. but i did what it said and it wont work here my script

var speed = 7.0; var rotateSpeed = 4.0;

function Update () { { controller : CharacterController } GetComponent(CharacterController);

 //Rotate around y - axis
 transform.Rotate(0, Imput.GetAxis ("Horizontal")  * rotateSpeed, 0);

 //  Move forward / backward
 var forward = transform.TransformDirection(Vector3).forward;
 var curSpeed = speed * Imput.Getaxis("Vertical");
 controller.SimpleMove(forward * curSpeed);

 }

 @script. RequireComponent(CharacterController)

Comment
Add comment
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

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Cyb3rManiak · May 08, 2011 at 08:21 AM

Dude, this is your script laid out neatly:

var speed = 7.0; var rotateSpeed = 4.0;

function Update () { { controller : CharacterController }

 GetComponent(CharacterController);

 //Rotate around y - axis
 transform.Rotate(0, Imput.GetAxis ("Horizontal")  * rotateSpeed, 0);

 //  Move forward / backward
 var forward = transform.TransformDirection(Vector3).forward;
 var curSpeed = speed * Imput.Getaxis("Vertical");
 controller.SimpleMove(forward * curSpeed);

}

@script. RequireComponent(CharacterController)

And this is your script (hopefully) without compilation errors:

@script RequireComponent(CharacterController)

var speed = 7.0; var rotateSpeed = 4.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);

}

First - try and lay out your scripts so they are readable. Way easier to spot mistakes and go over the codes that way. I hope you just copy-pasted it wrong, because if you continue this way, when your scripts get longer and more complex - they will become more and more of a mess...

Second - I'm all about messing around with the code, trial and error and stuff, but when you're starting out - try and understand the little things as much as possible. Do some tutorials, see some code other people wrote.

Third - try and play spot the difference between what you posted, and the code I did. I don't know exactly which line had the problem, but if you had corrected it - you would have another one, and another one. I spotted at least 3 syntax errors :/

Don't take it hard - I'm not criticizing, just trying to help you out here...

Comment
Add comment · 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
1

Answer by FLASHDENMARK · May 08, 2011 at 05:17 PM

Would this work?

var speed = 3.0; var rotateSpeed = 3.0;

function Update () { var controller : CharacterController = GetComponent(CharacterController); transform.Rotate(0, Input.GetAxis ("Horizontal") rotateSpeed, 0); var forward = transform.TransformDirection(Vector3.forward); var curSpeed = speed Input.GetAxis ("Vertical"); controller.SimpleMove(forward * curSpeed); }

@script RequireComponent(CharacterController)

You made a couple of mistakes.

Comment
Add comment · 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
0

Answer by noah · May 08, 2011 at 04:00 PM

o ok thanks for you r help

Comment
Add comment · 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
0
Wiki

Answer by noah · May 08, 2011 at 04:04 PM

ya but it says this i tried to fix it but i dont know whats wrong it says Assets/Standard Assets/NewBehaviourScript.js(14,47): BCE0023: No appropriate version of 'UnityEngine.Transform.TransformDirection' for the argument list '(System.Type)' was found.

heres my scritpt

script RequireComponent(CharacterController)

var speed = 7.0; var rotateSpeed = 4.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);

}

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 Mike 3 · May 08, 2011 at 04:08 PM 0
Share

just change it to var forward = transform.forward; no need for all the TransformDirection stuff. If you did wanna do it that way though, put the .forward right after Vector3 ins$$anonymous$$d of outside the bracket

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

help with UCE0001: ';' expected. Insert a semicolon at the end 3 Answers

Lerpz tutorial multiple errors.HELP!!!! 4 Answers

Limit rotation for a statue puzzle 1 Answer

Scripting Error when drawing texture to custom window; What am I doing wrong? 1 Answer

Desintergrate Enemies on Dying 4 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