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 tnk4 · Mar 19, 2014 at 05:11 PM · parsing errorplanes

Error CS8025: Parsing error. HELP!

I am new to all this, and I have begun a project for a game based around aircraft. To begin Im just starting with a basic code and for some reason whenever I begin playing it just says "error CS8025: Parsing error!"

This is the code;

 }
     var rotateSpeed = 25.0;
     var speed = 50.0;
     function Update() {
         var transAmount = speed * Time.deltaTime;
         var rotateAmount = rotateSpeed * Time.deltaTime;
         
         if (Input.GetKey("up")) {
             transform.Rotate(rotateAmount, 0, 0);
             
         }
         if (Input.GetKey("down")) {
             transform.Rotate(-rotateAmount, 0, 0);
         }
         if (Input.GetKey("left")) {
             transform.Rotate(0, -rotateAmount, 0);
         }
         if (Input.GetKey("right")) {
             transform.Rotate(0, rotateAmount, 0);
         }
         
         if (Input.GetKey ("z")) {
             transform.Rotate(0, 0, rotateAmount);
         }
         
         if (Input.GetKey ("x")) {
             transform.Rotate(0, 0, -rotateAmount);
         }
         
         if (Input.GetKey ("a")) {
             transform.Translate(0, 0, transAmount);
         }
         
         if (Input.GetKey ("q")) {
         transform.Translate(0, 0, (transAmount * 2));
         }
         
     }








Any help would be greatly appreciated. Thanks!

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
0
Wiki

Answer by perchik · Mar 19, 2014 at 05:24 PM

Your error message should refer to a specific line number which will tell you where the problem actually occurs (or within a line or two) and you should include that in your question.

With that said, if this is your complete code, you have a stray } at the very beginning, which will cause problems.

Comment
Add comment · Show 6 · 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 tnk4 · Mar 19, 2014 at 05:27 PM 0
Share

This is all my code (I removed that bracket you were on about) "(4,18): error CS0116: A namespace can only contain types and namespace declarations"

using UnityEngine; using System.Collections;

 public class NewBehaviourScript : $$anonymous$$onoBehaviour {
 
 
     var rotateSpeed = 25.0;
     var speed = 50.0;
     function Update() {
         var transAmount = speed * Time.deltaTime;
         var rotateAmount = rotateSpeed * Time.deltaTime;
         
         if (Input.Get$$anonymous$$ey("up")) {
             transform.Rotate(rotateAmount, 0, 0);
             
         }
         if (Input.Get$$anonymous$$ey("down")) {
             transform.Rotate(-rotateAmount, 0, 0);
         }
         if (Input.Get$$anonymous$$ey("left")) {
             transform.Rotate(0, -rotateAmount, 0);
         }
         if (Input.Get$$anonymous$$ey("right")) {
             transform.Rotate(0, rotateAmount, 0);
         }
         
         if (Input.Get$$anonymous$$ey ("z")) {
             transform.Rotate(0, 0, rotateAmount);
         }
         
         if (Input.Get$$anonymous$$ey ("x")) {
             transform.Rotate(0, 0, -rotateAmount);
         }
         
         if (Input.Get$$anonymous$$ey ("a")) {
             transform.Translate(0, 0, transAmount);
         }
         
         if (Input.Get$$anonymous$$ey ("q")) {
         transform.Translate(0, 0, (transAmount * 2));
         }
         
     }
avatar image perchik · Mar 19, 2014 at 07:29 PM 0
Share

It seems like you're writing C# in which case "function" is not the right syntax

ins$$anonymous$$d do

void Update(){

avatar image Dblfstr · Mar 19, 2014 at 07:36 PM 0
Share

Yes, you have some C# and JavaScript stuff mixed together.

avatar image Dblfstr · Mar 19, 2014 at 07:40 PM 0
Share
 using UnityEngine; 
 using System.Collections;
 
 public class NewBehaviourScript : $$anonymous$$onoBehaviour {
      
      
     float rotateSpeed = 25.0f;
     float speed = 50.0f;
 
     void Update() {
     float transAmount = speed * Time.deltaTime;
     float rotateAmount = rotateSpeed * Time.deltaTime;
      
       if (Input.Get$$anonymous$$ey("up")) {
         transform.Rotate(rotateAmount, 0, 0);
       }
 
       if (Input.Get$$anonymous$$ey("down")) {
         transform.Rotate(-rotateAmount, 0, 0);
       }
 
       if (Input.Get$$anonymous$$ey("left")) {
         transform.Rotate(0, -rotateAmount, 0);
       }
 
       if (Input.Get$$anonymous$$ey("right")) {
         transform.Rotate(0, rotateAmount, 0);
       }
      
       if (Input.Get$$anonymous$$ey ("z")) {
         transform.Rotate(0, 0, rotateAmount);
       }
      
       if (Input.Get$$anonymous$$ey ("x")) {
         transform.Rotate(0, 0, -rotateAmount);
       }
      
       if (Input.Get$$anonymous$$ey ("a")) {
         transform.Translate(0, 0, transAmount);
       }
      
       if (Input.Get$$anonymous$$ey ("q")) {
         transform.Translate(0, 0, (transAmount * 2));
       }
      
     }
 }
avatar image tnk4 · Mar 19, 2014 at 08:00 PM 0
Share

Ok, cheers for the help Dblfstr for the code, I am not recieving any "Cs8025" errors now, but NOW i am getting a new one;

"Actor::update$$anonymous$$assFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually! UnityEditor.DockArea:OnGUI()"

Show more comments

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

22 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

Related Questions

Multiple Cars not working 1 Answer

Why does my var speed say it is wrong 2 Answers

BCE0044: expecting }, found 'private'. PLEASE HELP!!!!! 2 Answers

How can i make the ray cast don't go through the walls 1 Answer

Object Reference Not Set to an Instance of an object 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