#I want to write my grid data to output
1 messages · Page 1 of 1 (latest)
Generation Script:
void GenerateGrid()
{
_tiles = new Dictionary<Vector2, Tile>();
for(int x = 0; x < _width; x++)
{
for(int y = 0; y < _height; y++)
{
var spawnedTile = Instantiate(_tilePrefab, new Vector3(x,y), Quaternion.identity);
spawnedTile.name = $"Tile {x} {y}";
var isOffset = (x % 2 == 0 && y % 2 != 0) || (x % 2 != 0 && y % 2 == 0);
spawnedTile.Init(isOffset);
_tiles[new Vector2(x,y)] = spawnedTile;
tiles.Add(spawnedTile.gameObject);
}
}
}
public Tile GetTileAtPos(Vector2 pos)
{
if(_tiles.TryGetValue(pos, out var tile))
{
return tile;
}
return null;
}
Basically the code generates a grid. I want to try revamp it, so it can output the changes i want & updates as a readable file. Like the example
I've also got the basic "Instantiate" for a game object with an [ID]
Pretty much want to set the generated code there as 0 and gameobjects with their IDs