In pc platform compiles ok, but in android not compile

I have an game that is write in JS.

The scripts works fine when I compile it to work in pc platform, but when I try to compile it in Android it give a lot of errors.

For example, the line below don’t compile in android, it only compiles in pc platform:
Glow.GetComponent(“Halo”).enabled = false;

It give the following error:
BCE0019: ‘enabled’ is not a member of ‘UnityEngine.Component’.

Why this is happening and how I can correct that?

Why this is happening
because duck-typing is disabled on mobiles.
iirc “#pragma strict” will disable it on dektops too - so you should use it
pragma strict scripting problem - Questions & Answers - Unity Discussions
have good description of what is happening

it’s possible to enable duck-typing in mobiles?

If is not possible enable duck-typing in mobile, how I can make a correct implementation of the following code?

if (GameController.GetComponent(“GameController”).CountDownToStart > 0)
{
//…more code
}

The problem here is because the ‘CountDownToStart’, is a variable of the ‘GameController’ script.

How I can access this variable?

  1. you can cast (meh, but you dont need to learn anything new and fancy)
  2. there is a generic GetComponent
    check
    Unity - Scripting API: GameObject.GetComponent
    and
    http://docs.unity3d.com/Manual/GenericFunctions.html

I use a cast, and the code works

The original code was:
Glow.GetComponent(“Halo”).enabled = false;

The modified code is:
(Glow.GetComponent(“Halo”) as Behaviour).enabled=false ;

or a long version could be used
var halo2 : Behaviour;
halo2 = Glow.GetComponent(“Halo”);
halo2.enabled=false;

The problem that I have, is I need to identify some type of objects, like Behaviour.

Thanks for the help