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
-1
Question by blaziken · Jan 10, 2014 at 09:35 PM · errorcs8025

error CS8025: Parsing error (sorry)

Hello guys, I know this is a common mistake that circulates around here the more I wanted to know how to fix this script:

using UnityEngine; using System.Collections;

 public class ControladorPersonagem : MonoBehaviour {
     
 public CharacterController CharacterController;
 
 public float characterSpeed;    
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
     if(Input.GetKey(KeyCode.RightArrow))
         {
             //meu carinha vai andar para a direita
     CharacterController.Move(new Vector3(characterSpeed,0,0)*Time.deltaTime);
     }//
         if(Input.GetKey(KeyCode.LeftArrow))
     {
     CharacterController.Move(new Vector3(-characterSpeed,0,0)*Time.deltaTime);
 }

I know this has been discussed before here on the forum but I still do not understand how these objects are application, sorry my english. ty :3

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 frarees · Jan 10, 2014 at 09:41 PM 2
Share

Would be great if you paste the whole script with proper indentation. Also, specify the line where it fails and some description. As I see you're having syntactic problems that are not referred with Unity itself but with C# understanding. This script won't compile as it's at least leaking some closing brackets } at the end to close if statement and Update method. Also, calling a field the same way as its class is not possible in this case, so it will give you problems.

avatar image blaziken · Jan 11, 2014 at 04:34 AM 0
Share

How would indentation Sorry I'm not very good with scripts D? The line that the problem is

if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.LeftArrow))

Sorry for noob questions have several more things I want to ask questions.

what happens is that I try to play in Unity to test the left arrow and it does the following problem:

Scrit: alt text

Error: alt text

alt text

avatar image robertbu · Jan 11, 2014 at 04:51 AM 0
Share

@frarees's comment indicated the problem with your script.

  • You are missing two closing brackets at the end of the file

  • You should not have a variable the same name as the class. Typically the Class will use an upper case starting letter where the variable will use a lower case letter. Here is your script with the two changes @frarees indicated:


    using UnityEngine; using System.Collections;

    public class ControladorPersonagem : $$anonymous$$onoBehaviour {

       public CharacterController characterController;
         
         public float characterSpeed;    
         // Use this for initialization
         void Start () {
             
         }
         
         // Update is called once per frame
         void Update () {
             if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.RightArrow))
             {
                 //meu carinha vai andar para a direita
                 characterController.$$anonymous$$ove(new Vector3(characterSpeed,0,0)*Time.deltaTime);
             }//
             if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.LeftArrow))
             {
                 characterController.$$anonymous$$ove(new Vector3(-characterSpeed,0,0)*Time.deltaTime);
             }
         }
     }
    

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by frarees · Jan 11, 2014 at 01:03 PM

I highly recommend you to stop posting every problem that you face and instead start discovering the tools you're gonna use i.e. Unity and C#. We cannot solve things for you because you don't even barely know what is going on. We all had to start from scratch once. I recommend you to watch the beginner level tutorials that Unity offers for free, as well as some C# related tutorials.

Comment
Add comment · Show 1 · 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 helloiam · Jan 11, 2014 at 01:33 PM 0
Share

Frarees is right you should learn the basics first and then face us with the problems you have these problems you deal with are mostly syntax errors.

avatar image
0

Answer by NutellaDaddy · Jan 11, 2014 at 04:54 AM

You need one more closing bracket. It's pretty simple but I'm glad to see people getting interested in scripting.

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

Answer by Infinite_Gamer · Jan 11, 2014 at 05:08 AM

I am new to this too but I think that this could help... I hope

By the way this script does not need the characterController

and I think this can work as its own script right now just copy/paste

 //Variables Start
 
 //Public Variables
 public int PlayerSpeed = 20;
 
 
 //Private Variables
 private Transform myTransform;
 
 //Variables End
 
 
 // Use this for initialization
 void Start () {
 
     myTransform = transform;
     
     
 }
 
 // Update is called once per frame
 void Update () {
 
     
     //move the player left and right
     myTransform.Translate(Vector3.right * PlayerSpeed * Input.GetAxis("Horizontal") * Time.deltaTime);

}

Again Hopes this helps you :D

Infininite Gamer

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

Answer by blaziken · Jan 11, 2014 at 11:43 AM

I followed all the tips and I thank you for them. Decided the following script that the Infinite Gamer despite being good for me is not going to help me continue to video lesson that I see and in which the teacher marked that way the script:

 using UnityEngine;
 
 using System.Collections;
 
  
 
 public class ControladorPersonagem : MonoBehaviour {
 
  
 
     public CharacterController characterController;
 
  
 
     public float characterSpeed;    
 
     // Use this for initialization
 
     void Start () {
 
  
 
     }
 
  
 
     // Update is called once per frame
 
     void Update () {
 
        if(Input.GetKey(KeyCode.RightArrow))
 
        {
 
          //meu carinha vai andar para a direita
 
          characterController.Move(new Vector3(characterSpeed,0,0)*Time.deltaTime);
 
        }//
 
        if(Input.GetKey(KeyCode.LeftArrow))
 
        {
 
          characterController.Move(new Vector3(-characterSpeed,0,0)*Time.deltaTime);
 
        }
 
     }
 
 }

Ok, everything worked fine but the following error appeared to me: alt text

Please forgive me for the noob questions but I unfortunately did not do well adequei even the interface in English or the scripts that are new to me, thanks for the understandability and again sorry.

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 frarees · Jan 11, 2014 at 01:05 PM 0
Share

You have to assign characterController from the inspector or from some other script. Otherwise it will contain a reference to null. Try not to add more questions as answers.

avatar image blaziken · Jan 11, 2014 at 04:20 PM 0
Share

It worked very well, thank you <3 Sorry for posting in the wrong area and am very grateful for the quick support of people from the forum.Ty <3

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

24 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

Related Questions

c# parsing error Help please and the error is at where it says public string Name 1 Answer

CS8025 Error (Parsing Error) 1 Answer

I keep getting CS8025 parsing error 1 Answer

CS8025 Parsing error 3 Answers

CS8025 parsing error 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