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 /
  • Help Room /
This question was closed Feb 02, 2015 at 05:55 PM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by MrEpic · Nov 18, 2013 at 07:25 PM ·

coding help! BCE0044: expecting ), found '{'.

Hello, I have being coding a script for PlayerStates to my controller has animations when it moves and i have been copying MRxTeaBag from youtubes script and i get errors that he doesn't Assets/scripts/Player.js(18,17): BCE0044: expecting ), found '{'. Assets/scripts/Player.js(30,1): BCE0044: expecting EOF, found 'else'. also what does EOF mean? I will show screenshots of my code:alt text

idk know if they are read able but my code is:

 var PlayerState : float;
 var PlayerAnimSec : GameObject;
 
 
 function Update () 
 {
 PlayerStateController();
 PlayerAnims();
 }
 
 
 
 function PlayerStateController()
 {
     if ((Input.GetAxis("Vertical") !=0 || Input.GetAxis("Horizontal") !=0))
 {
     if (Input.GetButton("Sprint")
         {
         PlayerState = 2;
         } 
         
         
 
     else
     {
     PlayerState = 1;
     }
     
 }
 else
 {
 PlayerState = 0;
 }
 }
 
 function PlayerAnims()
 {
     
 if (PlayerState == 0)
     {
     PlayerAnimSec.animation.CrossFade("Idle Animation", 0.4);    
     }
     
 else if (PlayerState == 1 )
     {
     PlayerAnimSec.animation.CrossFade("Walking Animation", 0.4);
     }    
     
 else if (PlayerState == 2 )
     {
     PlayerAnimSec.animation.CrossFade("Sprint Animation", 0.4);
     }
 }
code help 1.png (71.5 kB)
code help 2.png (75.2 kB)
Comment
Add comment · Show 2
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 rutter · Nov 18, 2013 at 07:42 PM 0
Share

@AeonIxion has it, below. As an aside, "EOF" is "end of file".

avatar image MrEpic · Nov 18, 2013 at 08:31 PM -1
Share

THAN$$anonymous$$S guys so much it really helped and worked a charm :D i hope the rest of my coding goes ok :]

2 Replies

  • Sort: 
avatar image
1
Best Answer

Answer by AeonIxion · Nov 18, 2013 at 07:35 PM

You forgot a ' )' on line 18.

Change

 if (Input.GetButton("Sprint")

to

 if (Input.GetButton("Sprint"))
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
1

Answer by JoeMGomes · Nov 18, 2013 at 07:42 PM

Change, in the line 18:

  if (Input.GetButton("Sprint")

to

 if (Input.GetButton("Sprint"))
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 ItsJoshFTW · Mar 05, 2016 at 09:01 PM 0
Share

Im doing a soccer ball physics script and i get the same error

BCE0044: expecting (, found 'StartPass'.

Here is my code

 if (inTrigger) {
     if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.Joystick1Button1) && !isPassing) {
         function StartPass(Pass.transform.position);
     }
 }
 
 var isPassing : boolean = false;
 var timeSoFar : float = 0;
 var timeToPass : float = 3; // how long you want the pass to take.
 var startPosition : Vector3 = Vector3.zero;
 var finalPosition : Vector3 = Vector3.zero;
 
 function StartPass( finalPos : Vector3 ) {
 var startPosition = Soccer.transform.position;
 var finalPosition = finalPos;
 var timeSoFar = 0;
 var isPassing = true;
 }
 
     function Update () {
         if ( isPassing ) {
             var percent = timeSoFar / timeToPass;
             Soccer.transform.position = Vector3.Lerp( startPosition, finalPosition, percent );
             timeSoFar += Time.deltaTime;
             if ( timeSoFar >= timeToPass ) {
                 isPassing = false;
             }
         }
     }

Follow this Question

Answers Answers and Comments

22 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

Related Questions

Can someone help me make a simple jump script? 6 Answers

; Expected HELP 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