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 ChibiChubbs · Apr 19, 2016 at 05:00 AM · parsing error

Error CS8025: Parsing error?

This may be a dumb question, but I have a parsing error in anim.setFloat("LastMoveY", lastMove.y); I have no idea to fix. (42,55) Error CS8025: Parsing error (last one is 42,55). When I delete that line of code, I get another error in 41,55. There's another parsing error if I delete that line as well. I need help.

using UnityEngine; using System.Collections;

public class JimController : MonoBehaviour {

 public float moveSpeed;

 private Animator anim;

 private bool playerMoving;
     private Vector2 lastMove.x;
     private Vector2 lastMove.y;
 

 // Use this for initialization
 void Start () {
     anim = GetComponent<Animator>();
 }
 
 // Update is called once per frame
 void Update () {

     playerMoving = false;
     
     if(Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < 0.5f )
     {
         transform.Translate (new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
         playerMoving = true;
         lastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
     }

     if(Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f )
     {
         transform.Translate (new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
         playerMoving = true;
         lastMove = new Vector2(0f, Input.GetAxisRaw ("Vertical"));
     }

     anim.SetFloat("MoveX", Input.GetAxisRaw("Horizontal"));
     anim.SetFloat("MoveY", Input.GetAxisRaw("Vertical"));
     anim.SetBool("PlayerMoving", playerMoving); 
     anim.SetFloat("LastMoveX", lastMove.x);
     anim.SetFloat("LastMoveY", lastMove.y);
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
0

Answer by Highwalker · Apr 19, 2016 at 06:28 AM

Your update is missing a closing bracket "}"

Comment
Add comment · Show 7 · 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 ChibiChubbs · Apr 20, 2016 at 03:18 AM 0
Share

Where do I put it?

avatar image meat5000 ♦ ChibiChubbs · Apr 20, 2016 at 10:08 AM 0
Share

That is totally up to you, within reason.

 Class
 {
     function
     {
          if-statements-etc
          {
          }
     }
     function
     {
     }
 }

In $$anonymous$$ono / VS, click the bracket and it will show you to opposing bracket by highlighting it. $$anonymous$$ake sure that each opening bracket has a closing bracket of matching flavour( () {} [] ) and follow the general outline Ive written there.

Generally if youve missed a bracket at the end of the function it needs to be placed just before the next function. I mean, you cant put it inside the next function and you cant place it early or you'll have code left out in the cold.

avatar image ChibiChubbs · Apr 20, 2016 at 02:47 PM 0
Share

Tried it and got rid of the parsing error. Now I have "A namespace can only contain types and namespaces" error on "void Start" and "void Update". This is frustrating.

avatar image NoseKills ChibiChubbs · Apr 20, 2016 at 03:16 PM 0
Share

Once again check that the format is what meat5000 said

 using xxx.yyy.zzz;
 Class
  {
      function
      {
           if-statements-etc
           {
           }
      }
      function
      {
      }
  }

$$anonymous$$ost likely now you have something outside the class' curlies that should be inside them

avatar image tanoshimi ChibiChubbs · Apr 20, 2016 at 03:21 PM 0
Share

That's because of...

 private Vector2 last$$anonymous$$ove.x;
 private Vector2 last$$anonymous$$ove.y;


avatar image ChibiChubbs tanoshimi · Apr 21, 2016 at 03:57 AM 0
Share

Still nothing. using UnityEngine; using System.Collections;

public class JimController : $$anonymous$$onoBehaviour {

 public float moveSpeed;

 private Animator anim;

 private bool player$$anonymous$$oving;
 private Vector2 last$$anonymous$$ove.x;
 private Vector2 last$$anonymous$$ove.y;

} // Use this for initialization void Start () { anim = GetComponent(); }

 // Update is called once per frame
 void Update () {

     player$$anonymous$$oving = false;

     if(Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < 0.5f )
     {
         transform.Translate (new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
         player$$anonymous$$oving = true;
         last$$anonymous$$ove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
     
     }
     if(Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f )
     {
         transform.Translate (new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
         player$$anonymous$$oving = true;
         last$$anonymous$$ove = new Vector2(0f, Input.GetAxisRaw ("Vertical"));
     }
     anim.SetFloat("$$anonymous$$oveX", Input.GetAxisRaw("Horizontal"));
     anim.SetFloat("$$anonymous$$oveY", Input.GetAxisRaw("Vertical"));
     anim.SetBool("Player$$anonymous$$oving", player$$anonymous$$oving); 
     anim.SetFloat("Last$$anonymous$$oveX", last$$anonymous$$ove.x);
     anim.SetFloat("Last$$anonymous$$oveY", last$$anonymous$$ove.y);
 }
Show more comments
avatar image
0

Answer by Blind_Eye_Gaming · Nov 26, 2016 at 03:34 AM

Also get the same error as them but I cant but in a bracket without getting errors

void Update () {

  if (Input.GetKey (shoot)) {
      Vector3 sp = Camera.main.WorldToScreenPoint(transform.position);
      Vector3 dir = (Input.mousePosition - sp).normalized;
      rigidbody2D.AddForce (dir * amount);
 
   }

}

Comment
Add comment · 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

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

error CS8025: Parsing error 0 Answers

error CS8025 (Parsing Error) 1 Answer

Parsing Error 0 Answers

Simple light switch problem 0 Answers

Parsin Error (C#) 2 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