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 iviaguic · Jul 04, 2013 at 07:41 PM · javascriptvariablescharactermotor

Error BCE0005 in Javascript

Hi all, just had a new problem with my code. I have Modified CharacterMotor.js (FPS Controller) to make my characters run, but i get these errors:

 Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js(342,46): BCE0005: Unknown identifier: 'currentSprintTime'.
 
 
 Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js(342,71): BCE0005: Unknown identifier: 'SprintCooldownOn'.
 
 Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js(371,43): BCE0005: Unknown identifier: 'maxSprintTime'.
 
 
 


This is the code:

 // The maximum horizontal speed when moving
 
     var maxForwardSpeed : float = 10.0;
     var maxSidewaysSpeed : float = 9.0;
     var maxBackwardsSpeed : float = 9.5;
     
     // [CUSTOM] Sprint duration
     var maxSprintTime : float = 20.0; // Time in seconds that player can sprint
     var currentSprintTime : float = 20.0; // Initial Sprint Time
     var SprintCooldownOn : boolean = false; // Sprint Cooldown Var
     var SprintOn : boolean = false; // Tells if Player is Sprinting
     
 function Update () {
     
         if ( Input.GetKey( "left shift" ) && currentSprintTime > 0 && SprintCooldownOn == false ) // CUSTOM SPRINT SCRIPT
         {
             movement.maxForwardSpeed = 15.0;
             movement.maxSidewaysSpeed = 14.0;
             movement.maxBackwardsSpeed = 14.5;
             
             SprintOn = true; // Sets Sprinting Mode ON
             
         }
         else
         {
             SprintOn = false;
         }
         
         
         
         
         
         if ( SprintOn == true && currentSprintTime > 0 )
         {
             currentSprintTime--; // Takes Time
         }
     
         if ( SprintOn == true && currentSprintTime == 0 )
         {
             SprintCooldownOn = true; // Sets Cooldown Mode ON
             
             currentSprintTime++; // Adds Time
             
             if ( currentSprintTime == maxSprintTime )
             {
                 SprintCooldownOn = false;
             }
         }
         
         
         
         
         
     
         if (!useFixedUpdate)
             UpdateFunction();
     }
Comment
Add comment · Show 4
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 create3dgames · Jul 04, 2013 at 08:49 PM 0
Share

The errors are on lines 342 and 371...and yet you only posted 57 lines here?

avatar image jg2115 · Jul 04, 2013 at 09:32 PM 0
Share

The error it says is in the character motor.

avatar image jg2115 · Jul 04, 2013 at 09:36 PM 0
Share

(the old character motor has that many lines)

avatar image oliver-jones · Jul 04, 2013 at 09:40 PM 0
Share

This might be a really stupid question (and slightly patronising), but have you saved your script since you made the changes?

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by jg2115 · Jul 04, 2013 at 09:54 PM

Instead try making it a separate script and calling the character motor like this:

 private var chMotor: CharacterMotor;
 private var ch: CharacterController;
 
     function Start(){
         chMotor = GetComponent(CharacterMotor);
         ch = GetComponent(CharacterController);
     }


and then you could adjust speed by

 chMotor.movement.maxForwardSpeed = sprintspeed;

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 iviaguic · Jul 05, 2013 at 02:28 PM 0
Share

Ok thanks, i'm a newbie with javascript. Also, what's the variable ch for?

avatar image jg2115 · Jul 05, 2013 at 07:38 PM 0
Share

You don't need ch, you could just use it if you wanted to see if the player was jumping or on the ground. I don't know if you need that for your game.

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

18 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

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

Having a script variable update between two objects 1 Answer

Finding what scene number player is on and adding one.... 1 Answer

A variable im trying to pull from another script is reseting when it shouldn't? 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