Hello everyone,
I have a level generated using cellular automata.
My map is 1366/768 and each pixel is a tile (black or white).
This is the code i use in void Start() to display the map :
public void RenderMap(bool[,] map, Tilemap tilemap, TileBase tileNone, TileBase tileExist)
{
//Clear the map (ensures we dont overlap)
tilemap.ClearAllTiles();
//Loop through the width of the map
for (int x = 0; x < map.GetLength(0); x++)
{
//Loop through the height of the map
for (int y = 0; y < map.GetLength(1); y++)
{
// 1 = tile, 0 = no tile
if (map[x, y] == false)
{
tilemap.SetTile(new Vector3Int(x, y, 0), tileNone);
}
else if (map[x, y] == true)
{
tilemap.SetTile(new Vector3Int(x, y, 0), tileExist);
}
}
}
}
I don’t know why but i have only 40 fps.
How can i improve that?
The final goal is to create a map where i can interact with each pixels (to create a destructible environment)