BCE0019: 'gameObject' is not a member of 'Object'.

Searched in sames question but didn’t found my case…
here’s the code:

var closeEnemies : Array = new Array(); 
//...
	for(var i : int = 0; i < closeEnemies.length + 1; i++) {
		if(closeEnemies *!= null) {*

_ closeEnemies*.gameObject.GetComponent(enemy).health -= damage;_
_
}else{_
_
i++;_
_
}_
_
}_
_
//…_
function OnCollisionEnter2D (other : Collision2D) {
_
if(other.gameObject.GetComponent(friendly).status == “Enemy” && ownCase.GetComponent(Case).empty == false) {_
_
y += 1;_
_
other.gameObject.GetComponent(numbers).x = y;_
_
closeEnemies[other.gameObject.GetComponent(numbers).x] = other.gameObject;_
_
}_
_
}*_

function OnCollisionExit2D (other : Collision2D) {
* if(other.gameObject.GetComponent(friendly).status == “Enemy” && ownCase.GetComponent(Case).empty == false) {*
closeEnemies[other.gameObject.GetComponent(numbers).x] = null;
* }*
}
As you can see closeEnemies is an Array wich I stock colliding gameObjects in.
I tried a lot of things but I still get **BCE0019: ‘gameObject’ is not a member of ‘Object’. ** error…
What’s wrong with the script ?
Thx for your help.

This line right at the top:

var closeEnemies : Array = new Array(); 

You don’t specify what closeEnemies is an array of. So its elements are all just generic “Objects”. And as the error messages states, objects don’t have a .gameObject property.

I don’t use Javascript, but I assume you meant something like:

var closeEnemies : GameObject[];