- Home /
Array Utility error while building project
So, hmmm, strange problem here: I have a simple script which uses ArrayUtility... I press play and everything is cool, but when I press build I get this debug message:
Assets/Scripts/Other/RaceSequencer.js(141,30): BCE0005: Unknown identifier: 'ArrayUtility'.
WHYYYY :<
What is ArrayUtility?: http://unity3d.com/support/documentation/ScriptReference/ArrayUtility.html
Answer by Wolfram · May 14, 2012 at 02:09 PM
ArrayUtility is an Editor class, it is not available in builds. Make sure this RaceSequencer.js does not use this class when building, for example by using Platform Dependent Compilation
Awwww, so I'll have to write my own then :| Well... thanks for answer :)
What?? Why is this Class not available at RunTime?? The Unity docs advises to use Builtin Array for speed of executions. However, all that speed is lost if one cannot use the ArrayUtility to make optimized searches with IndexOf().
Do you plan to add this Class to RunTime in the near future?
If you need to modify your array, use a List ins$$anonymous$$d of a builtin array.
If you just need IndexOf() - all it does is a linear search through the array anyway, so a simple foreach() or for() will do the same.
I cannot see how a UnityScript search with for() can have the same speed as an API method (probably coded in faster C). And as for lists, the documentation says they are slower than Builtin Arrays.
You won't need to roll your own method for the most case. See this answer.