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 Seventh Stealth · Sep 07, 2013 at 03:22 PM · javascriptvector3vector2function update

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.

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

2 Replies

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

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.

Comment
Add comment · Show 4 · 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 Seventh Stealth · Sep 07, 2013 at 10:32 PM 0
Share

Could you explain how I'm doing that and what I should remove from the script ?

avatar image meat5000 ♦ · Sep 07, 2013 at 11:15 PM 0
Share

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!

avatar image Eric5h5 · Sep 08, 2013 at 12:01 AM 0
Share

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.

avatar image Seventh Stealth · Sep 08, 2013 at 09:38 AM 0
Share

alright thanks Will do

avatar image
0

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

Comment
Add comment · Show 4 · 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 Seventh Stealth · Sep 07, 2013 at 05:53 PM 0
Share

didn't work

avatar image meat5000 ♦ · Sep 07, 2013 at 11:06 PM 0
Share

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).

avatar image Eric5h5 · Sep 07, 2013 at 11:56 PM 0
Share

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.

avatar image meat5000 ♦ · Sep 08, 2013 at 11:10 AM 0
Share

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

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

19 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

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


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