- Home /
 
Fixed error but error still shows in the console
  private var Bullet : GameObject;
  function Update(){
   //Get input position in pixels (screen-coordinates);
     Vector2 screenPos = Input.touches[0].position;
     //Convert from screen coordinates (pixels) to world-coordinates;
     Vector3 worldPos =  camera.ScreenToWorldPoint(new Vector3(screenPos.x, screenPos.y, camera.nearClipPlane));
 //Move the empty-object to the location of click/tap;
     transform.position = worldPos;
     //Instantiate a new object at that location
     Instantiate(Bullet , worldPos , Quaternion.identity);
     //Fire away!
 Bullet.rigidbody.AddForce(transform.forward * 5000);
 }
 
               In the console it brings up : Shoot.js(4,12): UCE0001: ';' expected. Insert a semicolon at the end. Shoot.js(6,12): UCE0001: ';' expected. Insert a semicolon at the end.
Line 4 and 6 both have semicolons at the end , but error still shows . I've saved and everything . They both also have Vector2/3 in it ? Does that have something to do with this.
Answer by Eric5h5 · Sep 07, 2013 at 06:27 PM
The compiler is only telling you what little it can figure out from what you gave it. The main problem is that you're trying to mix C# with Unityscript syntax, which you can't do. Use one language or the other.
Could you explain how I'm doing that and what I should remove from the script ?
You are mixing two different program$$anonymous$$g languages. Use either JavaScript (really UnityScript) or C#.
I believe I told you this in another of your questions and I also believe you gave me a -1 for it!
I'd recommend learning the syntax of program$$anonymous$$g languages. "Vector2 screenPos", for example, is not something you can write in Unityscript. $$anonymous$$issing semicolon errors are generally one of two things: either you actually did leave out a semicolon, or else you confused the compiler too much so it doesn't know where the statement is supposed to end.
Answer by legion_44 · Sep 07, 2013 at 03:34 PM
Close your script in your IDE (or shut down your IDE completely). Click Assets -> SyncMonoDevelop Project, then re-open that script via Unity (double click it) and save changes in it.
Hope that helps
Paul
Don't -1 people because the answer didn't work for you. Only -1 for a seriously bad answer. Fapawel's answer is perfectly viable and so should not be marked down.
(Seriously, people will help you less if they think you will -1 them for not being able to get the solution to work).
This answer has nothing to do with the question, though. "Restart stuff" won't magically fix script errors, so I wouldn't say it's a valid answer.
This answer has fixed similar problems for me. Not everything is a coding problem. Bad coding? Fine, but bugs do exist in Unity and restarting can solve some problems. When my editor wasn't updating variables properly from a script and causing all kinds of errors, restarting worked. For me this is a valid answer.
Your answer
 
             Follow this Question
Related Questions
Transfer values from C# to Javascript 1 Answer
Physics2D.Raycast "Vector3 to Vector2 conversion" [Solved] 1 Answer
Project a Vector3 onto a plane, orthographically 2 Answers
How to set a target position in Vector3.MoveTowards using a variable 2 Answers
Rotating Rigidbody properly using AddRelativeForce 0 Answers