I have two scripts ;
My first script is shipupgrade in the first object Cube;
var shipupgrade : int = 1;
function Start () {
}
function Update () {
}
and here is my second script script name : destroy in the second object Sphere;
function Start () {}
function Update () {
if(Input.GetKeyDown("u"))
if(gameObject.GetComponent(shipupgrade).shipupgrade == 1) {
gameObject.GetComponent(shipupgrade).shipupgrade += 1;
Destroy(this.gameObject);
}
}
this doesnt work why ? help me please it says Object reference not set to an istance of an object so what i must write ? thanks
they are not in same object