Hi,
I've tried to write this function:
private function lookForBloc(isSpawn:boolean,faction:String,isBorder:boolean,borders:String){
var result : GameObject;
var resulTab : GameObject[];
var number : int;
for (bloc in blocs)
{
var BA = bloc.GetComponent("BlocAttributes");
if(BA){
if(BA.isSpawn == isSpawn && BA.isBorder == isBorder)
{
if(isBorder && BA.borders == borders )
{
if(isSpawn && BA.faction == faction )
{
result = bloc;
}
result = bloc;
}
}
}
}
return result;
//~ number = Random.Range(0,resulTab.length);
//~ return resulTab[number];
}
But my problem is that i want an Array of results (as you can see in my comments) but when I try :
resulTab.Add(bloc);
or
resulTab[] = bloc;
or
resulTab *= bloc;*
*```*
*<p>It doesn't work, so I'd like to know how to store my GameObjects results in an Array.</p>*
*<p>Push doesn't work... I read that a List of GameObject would do it. But how can I declare one in JS ?*
*Thanks =D</p>*
Thanks a lot =D
– GeekURLant