Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by spkier · Feb 10, 2016 at 02:20 PM · error message

Error In The Script

here is my code i got only 1 error as i fixed most of them i get a error ; expected insert a semicolon at the end. but i get in no way where i should add the last semicolon i managfed to fix 8 errors in the script and updated it to untiy 5 but now i only got 1 single error wich i seems to not solve

here is my code

  int flyingSpeed = 100;
  int; speedChange = 20;
  int; rotationInt = 2;
  
  Update();
  {
  if (Input.GetKeyDown (KeyCode.W));
          {
              flyingSpeed += speedChange;
          }
  
  if (Input.GetKeyDown (KeyCode.S));
          {
              flyingSpeed += -speedChange;
          }
  
  if (Input.GetKey (KeyCode.A));
          {
              transform.RotateAround (transform.position, transform.up, -rotateInt);
          }
  
  if (Input.GetKey (KeyCode.D));
          {
              transform.RotateAround (transform.position, transform.up, rotateInt);
          }
   }

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 gjf · Feb 09, 2016 at 07:46 PM 2
Share

there are 8 errors in that code. you need to post the complete error messages when asking for help...

all of your errors are because you've added semicolons in places they should not be.

try some c# tutorials to help you become familiar with the syntax.

avatar image spkier gjf · Feb 10, 2016 at 02:44 PM 0
Share

no you're wrong im using a compleetly customeed unity 5 and these scripts are not wrong if you try to use this in unity 4 you will get 8 errors i know C pretty good + this is a java script i tried the error message is

":"Expected.insert semicolon at the end i got 8 errors of them and now i fixed it and only got 1 but no where to place it...

you need to learn how java works this scripts is not for C# was never either i am not the best at program$$anonymous$$g but sertain things i do know

avatar image meat5000 ♦ spkier · Feb 11, 2016 at 08:52 AM 0
Share
 no you're wrong im using a compleetly customeed unity 5 and these scripts are not wrong

LOL

1 Reply

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

Answer by Landern · Feb 10, 2016 at 02:47 PM

What gjf said, but you're using the line terminator to basically kill your if statements let alone your method called update which should have a return type(like IEnumerable) or void, you have terminators after the type when declaring variables. The code is also incomplete :(

 int flyingSpeed = 100;
 int speedChange = 20; // removed semicolon after the type declaration.
 int rotationInt = 2; // removed semicolon after the type declaration.
   
 void Update()
 {
     if (Input.GetKeyDown (KeyCode.W)) // removed semicolon after if statement
     {
         flyingSpeed += speedChange;
     }
 
     if (Input.GetKeyDown (KeyCode.S)) // removed semicolon after if statement
     {
         flyingSpeed += -speedChange;
     }
 
     if (Input.GetKey (KeyCode.A)) // removed semicolon after if statement
     {
         transform.RotateAround (transform.position, transform.up, -rotateInt);
     }
 
     if (Input.GetKey (KeyCode.D)) // removed semicolon after if statement
     {
         transform.RotateAround (transform.position, transform.up, rotateInt);
     }
 }

If this was actually meant to be unityscript/javascript(based off your comment above) then your script is completely wrong and should look more like:

 var flyingSpeed:int = 100;
 var speedChange:int = 20; // removed semicolon after the type declaration.
 var rotationInt:int = 2; // removed semicolon after the type declaration.
   
 function Update()
 {
     if (Input.GetKeyDown (KeyCode.W)) // removed semicolon after if statement
     {
         flyingSpeed += speedChange;
     }
 
     if (Input.GetKeyDown (KeyCode.S)) // removed semicolon after if statement
     {
         flyingSpeed += -speedChange;
     }
 
     if (Input.GetKey (KeyCode.A)) // removed semicolon after if statement
     {
         transform.RotateAround (transform.position, transform.up, -rotateInt);
     }
 
     if (Input.GetKey (KeyCode.D)) // removed semicolon after if statement
     {
         transform.RotateAround (transform.position, transform.up, rotateInt);
     }
 }

Comment
Add comment · Show 2 · 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 spkier · Feb 10, 2016 at 03:10 PM 0
Share

thanks understanded now im new to scripts but i do know the very well i midgh have gotten confused or something i dont know what i did

thanks to Ladern ad GFF for telling me now i get it :)

avatar image meat5000 ♦ spkier · Feb 11, 2016 at 08:53 AM 0
Share

Here is the tutorial page. Tutorials are the top, scripting and other categories at the bottom :)

Its really worth having a look and working through them.

Good luck!

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

41 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 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 avatar image avatar image avatar image

Related Questions

Unity WheelCollider.GetWorldPos expecting ), found 'pos' fix ?! 1 Answer

UCE0001 even though i got the semicolon right (i think) 1 Answer

Error CS1519 2 Answers

In Unity 5.3.1f1 (64-bit) version, its block my internet connection!! 0 Answers

How should I add a transform.position on a List? 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