//Tile Initialization public void InitializeBoard() { Vector3 boardRootPosition = transform.position; for (int i = 0; i > -1 * (boardLength + 2); i--) { for (int j = 0; j < boardWidth + 2; j++) { GameObject newBlock = (GameObject)Instantiate(BlockPrefab, boardRootPosition + new Vector3(j, 0, i), new Quaternion()); BlockData newBlockData = newBlock.GetComponent <BlockData> (); if (newBlockData != null) { newBlockData.x = j; newBlockData.y = i; if (i == 0 || i == -1 * (boardWidth + 1)) { newBlockData.GenerateBorderTiles(); } else if (j == 0 || j == boardLength + 1) { newBlockData.GenerateBorderTiles(); } else { newBlockData.GenerateTiles(1); //1 as dummy altitude } } newBlock.transform.SetParent(transform); } } }