Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by ThomasQ · Aug 02, 2011 at 04:01 PM · syntax-errorbce0005car-tutorialunity 3.4

BCE0005: Unknown identifier errors Unity 3.4

Hi All!

After upgrading to Unity 3.4 I got some errors on a Android build..

They are all BCE0005: Unknown identifier errors in the Car.js script that comes with the car tutorial, wich hasn't been altered, except for the controls.

The main errors are these: BCE0005: Unknown identifier: 'wheel'.

It errors at these lines:

 wheel = new Wheel(); 
 
 
 wheel.collider = wc;
 
 
    wheel.wheelGraphic = wheelTransform;


 wheel.tireGraphic = wheelTransform.GetComponentsInChildren(Transform)[1];

etc. Basicly every time that 'wheel' comes into play..

The next one is a BCE0005: Unknown identifier: 'accelerationTimer'.

     accelerationTimer = Time.time;


The last one is BCE0005: Unknown identifier: 'normPower'.

     normPower = (currentEnginePower / engineForceValues[engineForceValues.Length - 1]) * 2;


     currentEnginePower += Time.deltaTime * 200 * EvaluateNormPower(normPower);



Can anyone please help me make these lines Unity 3.4 / Android proof? The whole game is build around this script, and we've been stuck for a couple of days now..

Thanks a lot in advance!!

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 Graham-Dunnett ♦♦ · Aug 02, 2011 at 04:09 PM 0
Share

Can you post the code where you declare wheel, accelerationTimer and normPower. $$anonymous$$y guess is that you have not declared these anywhere.

avatar image ThomasQ · Aug 02, 2011 at 04:36 PM 0
Share

This is the NormPower function

 function CalculateEnginePower(relativeVelocity : Vector3){
 if(throttle == 0)
 {
     currentEnginePower -= Time.deltaTime * 200;
 }
 else if( HaveTheSameSign(relativeVelocity.z, throttle) )
 {
     normPower = (currentEnginePower / engineForceValues[engineForceValues.Length - 1]) * 2;
     currentEnginePower += Time.deltaTime * 200 * EvaluateNormPower(normPower);
 }
 else
 {
     currentEnginePower -= Time.deltaTime * 300;
 }
 
 if(currentGear == 0)
     currentEnginePower = $$anonymous$$athf.Clamp(currentEnginePower, 0, engineForceValues[0]);
 else
     currentEnginePower = $$anonymous$$athf.Clamp(currentEnginePower, engineForceValues[currentGear - 1], engineForceValues[currentGear]);}
avatar image ThomasQ · Aug 02, 2011 at 04:39 PM 0
Share

This is the Wheel Function

 function SetupWheel(wheelTransform : Transform, isFrontWheel : boolean)

 { var go : GameObject = new GameObject(wheelTransform.name + " Collider");
 go.transform.position = wheelTransform.position;
 go.transform.parent = transform;
 go.transform.rotation = wheelTransform.rotation;
     
 var wc : WheelCollider = go.AddComponent(typeof(WheelCollider)) as WheelCollider;
 wc.suspensionDistance = suspensionRange;
 var js : JointSpring = wc.suspensionSpring;
 
 if (isFrontWheel)
     js.spring = suspensionSpringFront;
 else
     js.spring = suspensionSpringRear;
     
 js.damper = suspensionDamper;
 wc.suspensionSpring = js;
     
 wheel = new Wheel(); 
 wheel.collider = wc;
 wc.sidewaysFriction = wfc;
 wheel.wheelGraphic = wheelTransform;
 wheel.tireGraphic = wheelTransform.GetComponentsInChildren(Transform)[1];
 
 wheelRadius = wheel.tireGraphic.renderer.bounds.size.y / 2;    
 wheel.collider.radius = wheelRadius;
 
 if (isFrontWheel)
 {
     wheel.steerWheel = true;
     
     go = new GameObject(wheelTransform.name + " Steer Column");
     go.transform.position = wheelTransform.position;
     go.transform.rotation = wheelTransform.rotation;
     go.transform.parent = transform;
     wheelTransform.parent = go.transform;
 }
 else
     wheel.driveWheel = true;
     
 return wheel;}
avatar image ThomasQ · Aug 02, 2011 at 04:42 PM 0
Share

And the last one: The accelerationTimer

 function Start(){    
 // $$anonymous$$easuring 1 - 60
 accelerationTimer = Time.time;
 
 SetupWheelColliders();
 
 SetupCenterOf$$anonymous$$ass();
 
 topSpeed = Convert_$$anonymous$$iles_Per_Hour_To_$$anonymous$$eters_Per_Second(topSpeed);
 
 SetupGears();
 
 SetUpSkidmarks();
 
 initialDrag$$anonymous$$ultiplierX = drag$$anonymous$$ultiplier.x;

}

6 Replies

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

Answer by ThomasQ · Aug 02, 2011 at 05:51 PM

The answer is indeed just putting 'var' in front of example wheel = new Wheel();

so

 wheel = new Wheel()

has to be

 var wheel = new Wheel()

I'm still not sure on the reason though, there are enough other variables being made without 'var'.. But I'm just glad that it works! Thanks guys!

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 jmpp · Aug 06, 2011 at 03:13 AM

The reason for this is that the JavaScript compiler shipped with Unity 3.4 became more stringent in its syntactic checks of scripts to better enforce its own guidelines. What you were seeing was the compiler chocking on "implicit variable declaration", which basically means that if an identifier (e.g. a variable name) is unknown at the time it is encountered the compiler creates it automatically. It seems to me like the JS guys over at UT decided it was a good enough trade-off to remove that feature from 3.4 to make it more compliant (meaning that now the compiler errors out automatically when encountering an unknown identifier), along with enforcing more stringent dynamic typing checks. For more info have a read at the JavaScript specific section of the release notes:

http://unity3d.com/unity/whats-new/unity-3.4

HTH! Regards,

  • jmpp

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 Njpatel4 · Feb 06, 2012 at 03:48 PM

Wow Unity answers is awsome!!

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 PeppeProduction · Nov 19, 2012 at 03:35 PM

you could have a. zip file of the complete project with the script and the car?

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 PeppeProduction · Nov 19, 2012 at 03:35 PM

I managed to make the script of the machine for Android without giving me errors but I can not now make the joystick can you tell me how to do it?

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
  • 1
  • 2
  • ›

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I have an error while building the game 1 Answer

Script won't run level (platformer tutorial) 1 Answer

I got a major question 1 Answer

Unknown Identifier "target" 3 Answers

Can't compile script from Scripting Tutorial (translated to Boo) 3 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