This is one of the bigger gotchas in Unity development: UnityScript on PC supports dynamic typing, but UnityScript on mobile does not.
When you declare an Array()
, everything you push or pop from the array is going to be cast as an Object
. There's no <
operator defined to compare Object
and float
. With dynamic typing enabled, the script engine will see that your variable is actually a float and proceed comparing it as such; with static typing, you'll have to cast it.
In some circumstances, UnityScript can infer a variable's type at declaration. In others, you're better off declaring the type yourself.
Google around a bit about Unity and developing with #pragma strict
to learn more about this.
For now, you should be able to proceed if you give your variable an explicit type:
//line 218
var exam : float = times[0];