• 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 Daze · Nov 12, 2012 at 04:33 PM · erroruce0001semicolonexpected

What am I missing? I already have the semicolon at the end..

 var target : Transform; //the enemy's target
 var moveSpeed = 3; //move speed
 var rotationSpeed = 3; //speed of turning
 var gravity: float = 20;
 var myTransform : Transform; //current transform data of this enemy
 
 function Awake()
 {
  myTransform = transform; //cache transform data for easy access/preformance
  var inFront : float = 10.0f;
 
  if(!Physics.Raycast(myTransform.position, myTransform.forward, inFront)){
   transform.Translate(Vector3.forward*currentMoveSpeed*Time.deltaTime);
  }
 }
 
 function Start()
 {
  target = GameObject.FindWithTag("Player").transform; //target the player
 }
 
 function Update () {
  //rotate to look at the player
  myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
  Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
  //move towards the player
  myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 }


Error message: "Assets/Enemy.js(21,6): UCE0001: ';' expected. Insert a semicolon at the end."

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

1 Reply

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

Answer by Graham-Dunnett · Nov 12, 2012 at 04:41 PM

This line:

 float inFront = 10.0f;

is not valid Javascript. Use

 var inFront : float = 10.0f;

instead. Note that if you double-click the error at the bottom of the Unity window you'll start MonoDevelop and get taken to the line with the problem. In the error message you get, the (21,6) say that the problem is on line 21 of your code.

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 Daze · Nov 12, 2012 at 05:02 PM 0
Share

ooh thanks man! but now I got a new error! :S "Assets/Enemy.js(25,37): BCE0005: $$anonymous$$ identifier: 'current$$anonymous$$oveSpeed'."

avatar image paulaceccon · Nov 12, 2012 at 05:07 PM 0
Share

Yeah, but you don't have this variable (current$$anonymous$$oveSpeed) declared in your code. You should declare it! ;D

avatar image Daze · Nov 12, 2012 at 05:18 PM 0
Share

Thanks a million mate! That fixed it, I really appreciate the fast answer! And as you might already have noticed, I am pretty new to Unity and programming so its really nice that there are people in this community that are willing to help! :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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

11 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

Related Questions

UCE0001 semicolon expected, please help 1 Answer

UCE0001: ';' expected. 2 Answers

UCE0001 ";" expected. insert a semicolan at the end? 1 Answer

UCE0001 error Insert a Semicolon at end 1 Answer

insert semicolon error 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges