Error: : BCE0019: xxx is not a member of 'Object'

Hello *,

before I reinstalled my Mac the game I’m working on could be compiled and run on the iPhone.

But since the reinstalltion I will get the Errors: xxx is not a member of ‘Object’.

I’m using the following code

var i: int;
var dummy: GameObject;
var other;

for (i = 0; i < 4; i++){
  poolBombOrRockets[i] = Instantiate(BombRocketPrefab[ii], Vector3(0,100,0), Quaternion.identity);
  dummy = poolBombOrRockets[i];
  other = dummy.GetComponent("Sidewinder");
  other.ID = i; // <- ERROR
  other.FallAsleep(); // <- ERROR
  poolBombOrRocketsActive[i] = false;
}

Errormessages:
BCE0019: ID is not a member of ‘Object’
BCE0019: FallAsleep is not a member of ‘Object’

Is there a flag in the editor or so which I could set or disable to make the game run again without changes on the source?

Thank you,
Ulrich

After the GetComponent(), you should test whether or not the object has been found. With a try/catch you could get the error desc.

Make sure the case is correct on object names.

Maybe try this.

var i: int;
var dummy: GameObject;
var other : Sidewinder; // Edited here

function Start()
    for (i = 0; i < 4; i++)
    {
        poolBombOrRockets[i] = Instantiate(BombRocketPrefab[ii], Vector3(0, 100, 0), Quaternion.identity);
        dummy = poolBombOrRockets[i];
        other = dummy.GetComponent(Sidewinder);
        other.ID = i; // <- ERROR
        other.FallAsleep(); // <- ERROR
        poolBombOrRocketsActive[i] = false;
    }
}

Try this. I haven’t tested it so i am not too sure. Hope that helps. :smile:

@ zine92

Thank you, now it works. :slight_smile:

Sadly I have another problem. The variables

var dummy: GameObject;
var other;

should be used several times with other script.

In the next line there stood

poolOppsPlanes = Instantiate(OppsPlanes[ii], Vector3(0, 100, 0), Quaternion.identity);
dummy = poolOppsPlanes*;*
other = dummy.GetComponent(OppsPlanes);
other.ID = i;
other.FallAsleep();
poolOppsPlanesActive = false;
Now I have to assign another variable “other” (e.g. "other2) This would go on until “other15”.
Do I really need to assign so much variables or can I use the same vaiable moreoften (to free it, re-assig it or so)?
Thank you,
Ulrich

“var other;” is a problem…always declare the type, either explicitly or implicitly by using a value. Whenever you have multiple variables that indicates you should be using a collection like an array.

–Eric