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 DestinyReborn · Aug 19, 2014 at 02:16 PM · errorparsing errorask

Error CS8025

Hello guys, I got an error with my script in unity: Assets/scripts/PlayerController.cs(69,17): error CS8025: Parsing Error. Can you please help me. Sry if my english isn't so perfect. I'm from germany

 public float jumpPower = 10;

 bool inputJump = false;
 float velocity = 0;
 Vector3 moveDirection = Vector3.zero;
 CharacterController characterController;
 SpriteController spriteController;

 // Use this for initialization
 void Start () {
     characterController = GetComponent<CharacterController> ();
     spriteController = GetComponent<SpriteController> ();
 
 }
 
 // Update is called once per frame
 void Update () {
     InputCheck ();
     Move ();
     SetAnimation ();
 }

 void InputCheck()
 {
     velocity = Input.GetAxis ("Horizontal") * speed;

     if (Input.GetKeyDown (KeyCode.Space)) {
         inputJump = true;
     } 
     else 
     {
         inputJump = false;
     }
 }

 void Move()
 {

         if (characterController.isGrounded)
         {
             if (inputJump)
                 moveDirection.y = jumpPower;
         }

     moveDirection.x = velocity;
     moveDirection.y -= gravity;
     characterController.Move(moveDirection *Time.deltaTime);
 }

 void SetAnimation()
 {

     if (velocity > 0) {
         spriteController.setAnimation (spriteController.AnimationType.goRight);
     }


     if (velocity < 0) {
         spriteController.setAnimation (spriteController.AnimationType.goLeft);
     }

 }    
Comment
Add comment · 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 DestinyReborn · Aug 19, 2014 at 01:52 PM 0
Share

using UnityEngine; using System.Collections;

public class PlayerController : $$anonymous$$onoBehaviour {

 public float gravity = 8;
 public float speed = 10;
 public float jumpPower = 10;

 bool inputJump = false;
 float velocity = 0;
 Vector3 moveDirection = Vector3.zero;
 CharacterController characterController;
 SpriteController spriteController;

 // Use this for initialization
 void Start () {
     characterController = GetComponent<CharacterController> ();
     spriteController = GetComponent<SpriteController> ();
 
 }
 
 // Update is called once per frame
 void Update () {
     InputCheck ();
     $$anonymous$$ove ();
     SetAnimation ();
 }

 void InputCheck()
 {
     velocity = Input.GetAxis ("Horizontal") * speed;

     if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.Space)) {
         inputJump = true;
     } 
     else 
     {
         inputJump = false;
     }
 }

 void $$anonymous$$ove()
 {

         if (characterController.isGrounded)
         {
             if (inputJump)
                 moveDirection.y = jumpPower;
         }

     moveDirection.x = velocity;
     moveDirection.y -= gravity;
     characterController.$$anonymous$$ove(moveDirection *Time.deltaTime);
 }

 void SetAnimation()
 {

     if (velocity > 0) {
         spriteController.setAnimation (spriteController.AnimationType.goRight);
     }


     if (velocity < 0) {
         spriteController.setAnimation (spriteController.AnimationType.goLeft);
     }

 }    

I forgot some lines from the text

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Landern · Aug 19, 2014 at 02:18 PM

This is typically a curly brace issue. IN the case of both your scripts posted above, you're missing an ending curly brace.

 using UnityEngine;
 using System.Collections;
 
 public class PlayerController : MonoBehaviour {
     public float gravity = 8;
     public float speed = 10;
     public float jumpPower = 10;
      
     bool inputJump = false;
     float velocity = 0;
     Vector3 moveDirection = Vector3.zero;
     CharacterController characterController;
     SpriteController spriteController;
      
     // Use this for initialization
     void Start () {
             characterController = GetComponent<CharacterController> ();
             spriteController = GetComponent<SpriteController> ();
      
     }
      
     // Update is called once per frame
     void Update () {
             InputCheck ();
             Move ();
             SetAnimation ();
     }
      
     void InputCheck()
     {
             velocity = Input.GetAxis ("Horizontal") * speed;
      
             if (Input.GetKeyDown (KeyCode.Space)) {
                     inputJump = true;
             } 
             else 
             {
                     inputJump = false;
             }
     }
      
     void Move()
     {
      
                     if (characterController.isGrounded)
                     {
                             if (inputJump)
                                     moveDirection.y = jumpPower;
                     }
      
             moveDirection.x = velocity;
             moveDirection.y -= gravity;
             characterController.Move(moveDirection *Time.deltaTime);
     }
      
     void SetAnimation()
     {
      
             if (velocity > 0) {
                     spriteController.setAnimation (spriteController.AnimationType.goRight);
             }
      
      
             if (velocity < 0) {
                     spriteController.setAnimation (spriteController.AnimationType.goLeft);
             }
      
     }  
 }
Comment
Add comment · 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 DestinyReborn · Aug 19, 2014 at 02:35 PM 0
Share

now I get the following error: Assets/scripts/PlayerController.cs(60,42) error CS1061: Type SpriteController' does not contain a definition for setAnimation' and no extension method setAnimation' of type SpriteController' could be found

avatar image Landern · Aug 19, 2014 at 02:37 PM 0
Share

Do you have a class/type called SpriteController?

avatar image DestinyReborn · Aug 19, 2014 at 02:40 PM 0
Share
 Vector3 moveDirection = Vector3.zero;
 CharacterController characterController;
 SpriteController spriteController;

Do you mean sth like this?

avatar image Landern · Aug 19, 2014 at 02:58 PM 0
Share

no, i mean if you're saying "spriteController" is of type "SpriteController" then SpriteController, the class must be defined somewhere, it's the blueprints that make up the objects that are of type SpriteController. Can you see it in your project? Unity is having issues finding it.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

4 errors in 1 script. Unexpected symbols and more, help please? 0 Answers

Error Building Player: 'aapt.exe' Win32Exception 3 Answers

BCE0044 unexpected char: 0xFEFF 2 Answers

£ Symbol won't work on Mac? 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