private void InitializeRooms() { BoundsInt bounds = metaTileMap.GetBounds(); int roomCounter = 1; System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); foreach (Vector3Int position in bounds.allPositionsWithin) { MetaDataNode node = metaDataLayer.Get(position, false); if ((node == null || node.Room == 0) && !metaTileMap.IsSpaceAt(position) && metaTileMap.IsAtmosPassableAt(position)) { if (FindRoom(position, roomCounter)) { roomCounter++; } } } sw.Stop(); Debug.Log("Room init: " + sw.ElapsedMilliseconds + " ms"); }