Operator ">" cannot be used with a left side of type "Object" and a right hand side of type "float", why?

Here’s the code:

Variables:

   var Distance ;
   var lookAtDistance = 25.0;

That line.

   if (Distance < lookAtDistance)

It happened, when i changed platforms, to android.

If you don’t give a variable a type, it has type object and therefore cannot be compared to a float. So you need to do:

var Distance : float;