I'm following this unity tutorial, but converting the script to UnityScript as I go.
Mostly it has been fine, but this line is throwing me.
Color[][] tiles = new Color[numTilesPerRow*numRows][];
I believe I should be doing something like this, but it isn't working.
var tiles = new Color[numTilesPerRow*numRows][];
I get an error:
';' expected. Insert a semicolon at the end.
Edit:
Here is the function I am converting in full:
Color[][] function ChopUpTiles() {
int numTilesPerRow = terrainTiles.width / tileResolution;
int numRows = terrainTiles.height / tileResolution;
Color[][] tiles = new Color[numTilesPerRow*numRows][];
for (int y=0; y<numRows; y++) {
for (int x=0; x<numTilesPerRow; x++) {
tiles[y*numTilesPerRow + x] = terrainTiles.GetPixels(x*tileResolution, y*tileResolution, tileResolution, tileResolution);
}
}
return tiles;
}
Edit 2:
I have worked out how to get it to work, but I get a downcast warning:
var tiles = new Array();
Does the job, but the problem is that I don't know to imply that this is an array of color arrays I get a downcast warning.