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 BontaGames · Aug 18, 2014 at 02:12 PM · javascripterror

BCE0043: Unexpected token: }.

 private var canWallJump : boolean=false;
 private var canWallJumpTime : float=0;
 private var canWallJumpDir : Vector3 = Vector3.zero;
 private var lastDirection : Vector3;
 
 function OnCollisionEnter(hit : Collision) {
     if(controller.isGrounded == false){
         for (var contact : ContactPoint in collision.contacts) {
             if(hit.collider.gameObject.tag == "Wall"){
             canWallJump = true;
             canWallJumpTime = Time.time;
             canWallJumpDir = Vector3.Scale(Vector3(-1,0,-1), lastDirection);
             }
         }
     }
 }
 
 function Update()
     {
     if(Time.time - canWallJumpTime > 0.25) canWallJump = false;
     if(Input.GetButtonDown ("Jump") ("canWallJump"))
     }
 
     // calculate movement and apply it to the controller
     if(Vector2(movement.x, movement.z).magnitude > 0.001) lastDirection = movement;
 }

I want to create a Parkour game with Wall jumps and I tried this script But if I save the script there comes this error: BCE0043: Unexpected token: }. Can you help me?

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 HarshadK · Aug 18, 2014 at 02:13 PM

Your Update loop should be:

 function Update()
     {
     if(Time.time - canWallJumpTime > 0.25) canWallJump = false;
     if(Input.GetButtonDown ("Jump") ("canWallJump"))
  
     // calculate movement and apply it to the controller
     if(Vector2(movement.x, movement.z).magnitude > 0.001) lastDirection = movement;
 }

There was a closing bracket after second if loop which closed the Update loop and the remaining lines of code were orphan.

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 BontaGames · Aug 18, 2014 at 02:30 PM 0
Share

Thanks for the fast answer :)
But there are 6 errors now:
BCE0005: $$anonymous$$ identifier:'movement'.
BCE0005: $$anonymous$$ identifier:'movement'.
BCE0005: $$anonymous$$ identifier:'movement'.
BCE0077: It is not possible to invoke an expression of type 'boolean'.
BCE0005: $$anonymous$$ identifier:'collision'.
BCE0005: $$anonymous$$ identifier:'controller'.
Hope you can help me again.

avatar image gjf · Aug 18, 2014 at 02:41 PM 0
Share

you haven't defined movement anywhere in the posted code...

and this line

 if(Input.GetButtonDown ("Jump") ("canWallJump"))

should be more like

 if(Input.GetButtonDown ("Jump"))
 {
     canWallJump = true;
 }

it's not clear what logic you want to execute if jump is pressed, but maybe you're going to tell some other function that the character can wall jump... just a guess on my part.

ALSO

you haven't defined controller or collision - maybe your cut & paste missed something...

FINALLY, when posting errors, please post the CO$$anonymous$$PLETE error including line numbers. you'll be amazed how useful they can be for us to help you.

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

2 People are following this question.

avatar image avatar image

Related Questions

Is not a Member of Collisions 2 Answers

Semi colon placement? unity error message 2 Answers

My Javascript is not opening 0 Answers

The name 'Message' does not denote a valid type ('not found'). 1 Answer

When I kill one enemy, the rest disapear, but still shoot 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