void CreateMeshAssets(Transform cave, string path) { string floorFolder = IOHelpers.CreateFolder(path, FLOOR_FOLDER); string ceilingFolder = IOHelpers.CreateFolder(path, CEILING_FOLDER); string wallFolder = IOHelpers.CreateFolder(path, WALL_FOLDER); foreach (Transform sector in cave.transform) { foreach (Transform component in sector) { if (Sector.IsFloor(component)) { CreateMeshAsset(component, floorFolder); } else if (Sector.IsCeiling(component)) { CreateMeshAsset(component, ceilingFolder); } else if (Sector.IsWall(component)) { CreateMeshAsset(component, wallFolder); } } } foreach (string folder in new[] { floorFolder, wallFolder, ceilingFolder }) { if (IOHelpers.IsFolderEmpty(folder)) { AssetDatabase.DeleteAsset(folder); } } }