• 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 ultimateronsu17 · Jun 03, 2015 at 11:44 AM · script error

TP_Animator script won't work

i'm following 3d buzz's tutorial on how to implament maya characters but this script has the following erors

Assets/TP Animator.cs(16,14): error CS1519: Unexpected symbol public' in class, struct, or interface member declaration Assets/TP Animator.cs(58,34): error CS1547: Keyword void' cannot be used in this context Assets/TP Animator.cs(58,35): error CS1525: Unexpected symbol (', expecting )', ,', ;', [', or =' Assets/TP Animator.cs(74,37): error CS1525: Unexpected symbol State' Assets/TP Animator.cs(82,44): error CS1525: Unexpected symbol case' Assets/TP Animator.cs(103,14): error CS0116: A namespace can only contain types and namespace declarations Assets/TP Animator.cs(137,1): error CS8025: Parsing error

and this is the script

using UnityEngine; using System.Collections;

public class TPAnimator : MonoBehaviour { public enum Direction { Stationary, Forward, Bacward, Left, Right, LeftForward, RightForward, LeftBackwards, RightBackward }

 public enum CharacterState
 {
     Idle, Running, RunningBackward, StrafingLeft, StrafingRight, Jumping,
     Falling, Landing, Climbing, Sliding, Using, Dead, ActionLocked
 public static TP_Animator Instance;

 public Direction MoveDirection { get; set; }
 public CharacterState State { get; set; }

 void Awake () 
 {
     Instance = this;
 }

 void Update () 
 {
     DetermineCurrentState();
     ProcessCurrentState();

     Debug.Log("Current Character State: " + State.ToString());
 }

 public void DetermineCurrentMoveDirection()
 {
     var forward = false;
     var backward = false;
     var left = false;
     var right = false;
             
     if (TP_Motor.Instance.MoveVector.z > 0)
         forward = true;
     if (TP_Motor.Instance.MoveVector.z < 0)
         backward = true;
     if (Tp_Motor.Instance.MoveVector.x > 0)
         right = true;
     if (Tp_Motor.Instance.MoveVector.x < 0)
         left = true;

     if (forward)
     {
        if (left)
            MoveDirection = Direction.LeftForward;
        else if (right)

            MoveDirection = Direction.RightForward;

 void DetermineCurrentState()
 {
     if (State == CharacterState.Dead)
         return;

         if (!Tp_Controller.CharacterController.isGrounded)
         {
             if (State != CharacterState.Falling &&
                 State != CharacterState.Jumping &&
                 State != CharacterState.Landing)
         {
                 //We Should be falling
         }
         if (State != CharacterState.Falling &&
             State != CharacterState.Jumping &&
             State != CharacterState.Landing
             State != CharacterState.Using &&
             State != CharacterState.Climbing &&
             State != CharacterState.Sliding)
         {
             switch (MoveDirection)
             {
                 case Direction.Stationary:
                     State = CharacterState.Idle;
                 case Direction.Forward:
                     State = CharacterState.Running;
                 case Direction.Bacward:
                     State = CharacterState.RunningBackward;
                 case Direction.Left:
                     State = CharacterState.StrafingLeft;
                 case Direction.Right:
                     State = CharacterState.StrafingRight;
                 case Direction.LeftForward:
                     State = CharacterState.Running;
                 case Direction.RightForward:
                     State = CharacterState.Running;
                 case Direction.LeftBackwards:
                     State = CharacterState.RunningBackward;
                 case Direction.RightBackward:
                     State = CharacterState.RunningBackward;
             }
         }
     }
 }

 void ProcessCurrentState()
 {
      switch (State)
     {
         case CharacterState.Idel:
             break;
         case CharacterState.Running:
             break;
         case CharacterState.RunningBackwards:
             break;
         case CharacterState.Idel:
             break;
         case CharacterState.StrafingLeft:
             break;
         case CharacterState.StrafingRight:
             break;
         case CharacterState.Jumping:
             break;
         case CharacterState.Falling:
             break;
         case CharacterState.Landing:
             break;
         case CharacterState.Climbing:
             break;
         case CharacterState.Sliding:
             break;
         case CharacterState.Using:
             break;
         case CharacterState.Dead:
             break;
         case CharacterState.ActionLocked:
             break;
     }
 }

}

any help on whats wrong???

by the way it's a c# script

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

Answer by Adamcbrz · Jun 04, 2015 at 03:35 AM

It looks like you are missing at least 2 closing brackets ( } ) after MoveDirection = Direction.RightForward;

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

'parent' is not a member of 'Object'. 1 Answer

Csharp script parsing error 2 Answers

my STFPSC script has errors can anyone help me? 0 Answers

Object reference not set to an instance of an object error. 1 Answer

MeshCombineUtility problem after upgrade to Unity 5? 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