var chutist : GameObject;
var chutistClone : GameObject;
function Start () {
chutistClone = Instantiate(chutist, Vector3(transform.position.x,transform.position.y -0.85, transform.position.z),transform.rotation);
}
function OnTriggerEnter(Col : Collider){
if (Col.gameObject.tag == "Bullet"){
life -= 10;
}
if (life == 0){
chutistClone.rigidbody.drag = 0;
chutistClone.GetComponent(chutist).drop = true;
yield WaitForSeconds (0.01);
destruct();
}
This is about the part “chutistClone.GetComponent(chutist).drop = true;”
I’ve checked out various methods of accessing scripts on other objects,
But I can’t figure out why this does not work.
Unity gives me:
BCE0023: No appropriate version of ‘UnityEngine.GameObject.GetComponent’ for the argument list ‘(UnityEngine.GameObject)’ was found.
If I change (chutist) to (“chutist”) it gives me:
BCE0019: ‘drop’ is not a member of ‘UnityEngine.Component’.
What am I missing? What am I doing wrong?
Thanks in advance, Bor.