// gets called when this cube is being destroyed // Refreshes other surrounding cubes private void AdjustNeighbours() { for (int i = 0; i < 6; i++) { Vector3 neighbourCube = transform.position + directions[i]; if (cubeParent == null) { print("getting parent"); cubeParent = GetComponentInParent <ChunkGenerator>(); } CubeEditor temporaryCubeEditor = cubeParent.GetCubeEditorByVector(neighbourCube); if (temporaryCubeEditor == null) { continue; } if (temporaryCubeEditor.childTable.ContainsKey(-directions[i])) { temporaryCubeEditor.childTable[-directions[i]].gameObject.SetActive(true); } else { temporaryCubeEditor = cubeParent.GetEditorFromNeighbourChunk(neighbourCube); if (temporaryCubeEditor == null) { continue; } if (temporaryCubeEditor.childTable.ContainsKey(-directions[i])) { temporaryCubeEditor.HideTransformByVector(-directions[i]); } } } }