public void CreateTiles(GridData gridData) { _width = gridData.GetWidth(); _height = gridData.GetHeight(); for (int column = 0; column < _width; ++column) { for (int row = 0; row < _height; ++row) { Vector3 tilePosition = new Vector3(CalculateTilePosition(column, _height), CalculateTilePosition(row, _width), 0.5f); GameObject tile = Instantiate(_tilePrefab, tilePosition, Quaternion.Euler(-90, 0, 0)) as GameObject; TileDisplay tileDisplay = tile.GetComponent <TileDisplay>(); tileDisplay.SetCoordinates(column, row); // Don't display grid lines for the last column/row, so // that we get that traditional noughts and crosses grid. tileDisplay.EnableRightLine(column < _width - 1); tileDisplay.EnableTopLine(row < _height - 1); eState state = gridData.GetTileState(new Move(column, row)); tileDisplay.UpdateDisplay(state); tile.name = CreateTileName(column, row); } } }