Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 /
This question was closed Jul 25, 2015 at 03:51 PM by Graham-Dunnett for the following reason:

Duplicate Question - cs8025 covered many times

avatar image
0
Question by metaldc4life · Jul 23, 2015 at 10:09 PM · cs8025compile errors

How do i fix this CS8025 Parsing Error?

Hi! Please do not laugh but I am having trouble with this ONE problem I am NOT a coder at all because I do level design and the like, so here is my problem I wanted to try and make a NPC follow my player so I put together this that I have found but seems to be an incomplete script because I get one error.. first here is the code:

 { if (Vector3.Distance(target.position, myTransform.position) > maxdistance);
   // Get a direction vector from us to the target
   Vector3 dir = target.position - myTransform.position;
 
 
 1. // Normalize it so that it's a unit direction vector dir.Normalize(); // Move ourselves in that direction myTransform.position += dir  moveSpeed  Time.deltaTime; 
 
 

Then, here is my one error message,

Assets/follow_script.cs(1,1): error CS8025: Parsing error

What did I do wrong??

Thank You!!!

Comment
Comments Locked · Show 1
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 RLin · Jul 23, 2015 at 10:16 PM 0
Share

Is this the entire code?

1 Reply

  • Sort: 
avatar image
3

Answer by smallbit · Jul 24, 2015 at 03:13 AM

you need to paste entire code here because its a little bit confusing. Parsing error is due to the fact that you are missing "}" bracket, my confusion is whether your "{" bracket comes from another if or a method or it is suppose to be for the if, or its just not needed at all and your if statement executes just 1 line of code. Also putting semicolon ";" in the end of if statement will cause it to execute every time so you better remove it too;

try this in case you have 1 line of code

  if (Vector3.Distance(target.position, myTransform.position) > maxdistance)
     Vector3 dir = target.position - myTransform.position;

or this if you execute more code there

  if (Vector3.Distance(target.position, myTransform.position) > maxdistance)
    {
  Vector3 dir = target.position - myTransform.position;
 }


so first try just removing "{" from start of first line, or post entire script here if its not solving problem for you

Comment
Comments Locked · 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 metaldc4life · Jul 24, 2015 at 08:38 PM 0
Share

Well I did this and I think it's kind of narrowed down with the help you gave me but there is still just one parsing error here is the whole code I tried.. I also tried removing the brackets but to no avail it still comes up with an error? Really Thankful For Your Continual Help! =)

 if (Vector3.Distance(target.position, myTransform.position) > maxdistance)
 {    // Get a direction vector from us to the target
     Vector3 dir = target.position - myTransform.position;
     // Normalize it so that it's a unit direction 
     vector dir.Normalize(); 
     // $$anonymous$$ove ourselves in that direction 
     myTransform.position += dir  moveSpeed  Time.deltaTime; 
     Vector3 dir = target.position - myTransform.position;
     
 
avatar image AlwaysSunny · Jul 24, 2015 at 08:41 PM 0
Share
 vector dir.Normalize(); 

This line makes no sense. Perhaps you meant:

 dir.Normalize();

I assume you wanted to multiply these values and lost your astericies.

 myTransform.position += dir * moveSpeed * Time.deltaTime; 

You're also trying to declare the dir vector twice.

 Vector3 dir = foo;
 Vector3 dir = bar;

This is improper. Declare it once:

 Vector3 dir = foo;
 dir = bar;

You're missing the closing curly brace for this IF conditional block

avatar image tanoshimi · Jul 24, 2015 at 09:21 PM 2
Share

Hang on... "here is the whole code" - so you don't have a class declaration? No functions? No using UnityEngine?

avatar image metaldc4life · Jul 25, 2015 at 03:52 PM 0
Share

Please read my first line tanoshimi.. I am NOT a coder.... I'll try to work with it and see what I come up with AlwaysSunny.. Thank You For The Help and will be back if I get more errors.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

add two compile instruction into "smcs.rsp",lead to internal compile error! 2 Answers

whats wrong with this code for a menu 3 Answers

Parsing error 0 Answers

parsing error on c# do not destroy code 1 Answer

CS8025 Parsing Error Please Help 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