ERROR GetComponent .enabled???

Hi the script that i’m using works great but the only issue is when i change the platform to android it doesn’t reconise enabled in the following line…

GetComponent (“Movement_Down”).enabled=false;

So the question would be what can i change it to get that working???

P.S. Ive tried .active which aloud me to test the came but when i clicked on the screen to make the helicopter go up it disappeared…

One of the worst gotchas in Unity development is that JavaScript on PC supports dynamic typing, but JavaScript on Android or iOS does not. This is one reason why new developers are encouraged to use #pragma strict at the top of all scripts (it turns off some of the more “dangerous” features in JS).

In your case, it’s important to understand that there are two versions of GetComponent:

//returns a Component reference
GetComponent ("Movement_Down")

//returns a Movement_Down reference
GetComponent(Movement_Down)

Note the quotes are gone in the second example.

Thanks for that now there is no errors but…this is the line of code that i was using…

var YAxisSpeedUp = 0.03;

var Helicopter : Transform;

private var nextFire : float = 0.0;

function Update()

{

if (Input.GetButton("Fire1") && Time.time > nextFire)

{

nextFire = Time.time + 0.0;

transform.Translate(0, YAxisSpeedUp, 0);


Helicopter.transform.rotation = Quaternion.Euler(20, 0, 0); 

	
GetComponent ("Movement_Down").enabled=false;

}

if (Input.GetButtonUp("Fire1"))

{

GetComponent ("Movement_Down").enabled=true;

Helicopter.transform.rotation = Quaternion.Euler(0, 0, 0); 

}
}

and i changed it to this to get it working on android but when you click the mouse button the helicopter just hovers and doesn't go back up.


var YAxisSpeedUp = 0.03;

var Helicopter : Transform;

private var nextFire : float = 0.0;

function Update()

{

if (Input.GetButton("Fire1") && Time.time > nextFire)

{

nextFire = Time.time + 0.0;

transform.Translate(0, YAxisSpeedUp, 0);


Helicopter.transform.rotation = Quaternion.Euler(20, 0, 0); 

	
GetComponent (Movement_Down);

}

if (Input.GetButtonUp("Fire1"))

{

GetComponent (Movement_UP);

Helicopter.transform.rotation = Quaternion.Euler(0, 0, 0); 

}
}