public void UpdateMap() { bool mapHasBeenUpdate = false; for (int y = 0; y < 20; y++) { for (int x = 0; x < 20; x++) { if (map.chunkNeedTextureUpdate[x, y] || map.chunkNeedMeshUpdate[x, y]) { if (map.chunkNeedMeshUpdate[x, y]) { MeshGenerator.AsyncGenerateChunk(new Vector2Int(x, y), map, gfxsMap[x, y]); map.chunkNeedMeshUpdate[x, y] = false; } if (map.chunkNeedTextureUpdate[x, y]) { TextureGenerator.AsyncGenerateTextureChunk(new Vector2Int(x, y), map, gfxsMap[x, y]); map.chunkNeedTextureUpdate[x, y] = false; } mapHasBeenUpdate = true; } } } if (mapHasBeenUpdate) { MapUpdateEvent?.Invoke(); } }