- Home /
Error with an Array
I getting an error in this code:
Controle.arrayOfSelectedCordinates=new array(majorY-minorY*majorX-minorX);
for(i=0;i<majorY-minorY;i++)
{
for(j=0;j<majorX-minorX;j++)
{
Controle.arrayOfSelectedCordinates[Controle.arrayOfSelectedCordinates.Length]=new array(2);
Controle.arrayOfSelectedCordinates[Controle.arrayDeCoordenadasSelecionadas.Length][0]=minorX+j; Controle.arrayOfSelectedCordinates[Controle.arrayDeCoordenadasSelecionadas.Length][1]=majorY-i;
}
}
Assets/Scripts/OperacoesDeControle.js(37,102): BCE0023: No appropriate version of 'Boo.Lang.Builtins.array' for the argument list '(int)' was found. Assets/Scripts/OperacoesDeControle.js(28,53): BCE0023: No appropriate version of 'Boo.Lang.Builtins.array' for the argument list '(int)' was found.
Someone knows what it means? I trying to make an 2D array of coordinates between 2,1 and 4,5 for example, and it is what this code should do.
Answer by Eric5h5 · Apr 05, 2012 at 09:16 PM
Array is upper-case, not lower-case, but you shouldn't use it anyway. Just use a 2D array.
var coords = new int[x, y];
Hey dude, thanks for your active support in community. I tried to change code to:
var arrayOfSelectedCordinates=new int[maiorY-menorY*maiorX-menorX,2]; var contador:int =0;
for(i=0;i<maiorY-menorY;i++)
{
for(j=0;j<maiorX-menorX;j++)
{
arrayOfSelectedCordinates[contador,0]=menorX+j;
arrayOfSelectedCordinates[contador,1]=maiorY-i;
contador++;
}
}
But I got this problem:
$$anonymous$$issingFieldException: Field 'System.Int32[,].' not found. relative to this line: arrayOfSelectedCordinates[contador,0]=menorX+j;
If I define the maiorY etc. variables, and copy that code into a Start function, it compiles without any errors. Are you using an old version of Unity?
I installed the new version. Problem continues: $$anonymous$$issingFieldException: Field 'System.Int32[,].' not found.
Don't know what to say, the code you posted compiles without errors as I said above.