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?
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?
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