Accessing variable of script on an instance.

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.

The problem is that you are sending a game object into a function that expect a type.

var chutist : GameObject;
...
chutistClone.GetComponent(chutist).drop = true;

I would assume you meant to do something similar to this:

chutistClone.GetComponent.<ChutistScript>().drop = true;

But I don’t know the type of the component you are trying to access.

Change ChutistScript to the type of component that has the drop variable.

If you get a null reference exception after you do this, it likely means that you don’t have the script on the object you cloned.