ok, so I have been trying to figure this out for two days now. The for loop in my StartingFloor() function works fine if I comment out the instantiate like, but otherwise, it crashes.
var Tile : GameObject;
var gameStart = true;
function StartingFloor(FloorTile : GameObject) {
var tilesInRow = 7;
var rowsInColumn = 7;
var HALF_ROW = 3;
var TILE_SIZE = 0.24;
var tileY = 0;
for(var tileX = 0; tileX < tilesInRow; tileX++) {
var tilePosition = Vector3(-1 * (HALF_ROW * TILE_SIZE) + (tileX * TILE_SIZE), tileY, 0);
Instantiate(FloorTile, tilePosition, FloorTile.transform.rotation);
if((tileX - (tilesInRow - 1)) % tilesInRow == 0) {
tileY += 1;
}
yield WaitForSeconds(3);
Debug.Log(tileX);
}
}
function Start () {
StartingFloor(Tile);
}
↧