public void Execute(int index) { int position = surfaceVoxelsIndex[index]; int3 position3 = VoxelUtility.Index1ToIndex3(position); Debug.Assert(surfaceVoxels.TryGetValue(position, out bool v)); int noNeighborCount_Debug = 0; int3[] neighborPosition3 = new int3[] { position3 + new int3(1, 0, 0), position3 + new int3(-1, 0, 0), position3 + new int3(0, 1, 0), position3 + new int3(0, -1, 0), position3 + new int3(0, 0, 1), position3 + new int3(0, 0, -1) }; foreach (var neighborPos in neighborPosition3) { if (!surfaceVoxels.TryGetValue(VoxelUtility.Index3ToIndex1(neighborPos), out bool v1)) { int surface = VoxelUtility.GetSurfaceIndex(position3, neighborPos); surfaceFaces.TryAdd(surface, true); noNeighborCount_Debug++; } } if (noNeighborCount_Debug == 6) { Debug.LogError("No neighboring voxel for " + position3); } }