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 BitHag · Apr 19, 2013 at 04:36 PM · mobilebce0005unknown identifier

Only in Mobile BCE0005: Unknown identifier

Hello! Thanks for taking a look!

So the unity console spits out error BCE0005: Unknown identifier on every call of x and t2

i have no clue as to why is this is, as the code was running well when testing in desktop mode, i switch to Ios and this.

Any help would be greatly appreciated and an explanation of why this is happening would really help me out.

 import UnityEngine.Mathf;
 
 var segements : Transform[]; 
 var res : int = 5; 
 var string : LineRenderer;
 var stringLength : float = 4; 
 
 function Awake () {
 
     segements[0] = GameObject.FindWithTag ("Player Hand").transform; 
     for (x=1;x<segements.length;x++) {
         var joint  = segements[x].GetComponent ("ConfigurableJoint"); 
         segements[x].position = segements[0].position;
     }
     segements[1].GetComponent ("ConfigurableJoint").connectedBody = segements[0].rigidbody; 
     
     for (x=1;x<segements.length;x++) {
         joint  = segements[x].GetComponent ("ConfigurableJoint");
         segements[x].position = segements[0].position + Vector3(0,joint.linearLimit.limit * x,0);
     }
 }
 
 function Update () {
     stringLength += Input.GetAxis ("StringAdjust")*0.2; 
     stringLength = Mathf.Clamp (stringLength,0.5,30); 
     string.SetVertexCount (res); 
     for (var i : float =0;i<res;i++) {
         string.SetPosition (i,CubicBezier (i/(res-1),segements[0].position,segements[1].position,segements[2].position,segements[3].position)); 
     }
     for (x=1;x<segements.length;x++) {
         segements[x].GetComponent ("ConfigurableJoint").linearLimit.limit = stringLength/(segements.length-1); 
     }
 }
 
 static function CubicBezier (t : float,p0 : Vector3,p1 : Vector3,p2 : Vector3,p3 : Vector3) {
     t = Clamp01 (t); 
     t2 = 1-t;
     return Pow(t2,3) * p0 + 3 * Pow(t2,2) * t * p1 + 3 * t2 * Pow(t,2) * p2 + Pow(t,3) * p3; 
 }

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

2 Replies

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

Answer by Graham-Dunnett · Apr 19, 2013 at 10:32 PM

Every javascript script in Unity needs to start with:

 #pragma strict

This says to the compiler that the JS script you write will have every variable correctly typed and declared. See here. Your variables x and t2 are not declared anywhere, that is, you do not have a declaration for them. If you add:

 var x : int;

and

 var t2 : float;

to your code in appropriate places you'll see the error disappears. Never, ever remove the pragma-strict from the code, and instead, fix the errors that occur in your code.

Finally, if you need to ask help about errors in your code, please consider posting the line numbers where the errors occur. The line number is the first of the pair of numbers in parentheses.

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 BitHag · Apr 20, 2013 at 12:49 PM 0
Share

Not sure bit i think i just lost my reply so is this is a duplicate then sorry

Thanks for the help Graham,

for anyone else that my see this, I had to use

static var x : int;

static var t2: float;

but everything is working perfectly now !

I had a read up on #pragma strict i see the error of my ways, Thanks again for the pro tips Graham!

avatar image
0

Answer by BitHag · Apr 20, 2013 at 12:45 PM

Thanks for the help Graham i owe you one!

Just for anyone else who might see this i had to use

static var x : int;

static var t2: float;

so now its working perfectly!

Also i had i read up on #pragma strict and see the error of my ways, thanks again for the pro tips Graham!

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.

Follow this Question

Answers Answers and Comments

12 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

Related Questions

BCE0005 unknow identifier 'rigidbody' 0 Answers

BCE0005 Unknown identifier issue 1 Answer

Publish 2D tutorial to IOS problem 0 Answers

Error building 2D Gameplay tutorial 0 Answers

Another "BCE0005: Unknown identifier:" error (following tutorial) 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