void VisualizeGrid() { GameObject visualizationParent = new GameObject("VisualizationParent"); visualizationParent.transform.SetParent(this.transform); for (int x = 0; x < perlinGridStepSizeX; x++) { for (int y = 0; y < perlinGridStepSizeY; y++) { if (SampleStepped(x, y) < heightline[0]) { visualizationCube = MapGeneration.BlockChoose(0); } else if ((SampleStepped(x, y) < heightline[1])) { visualizationCube = MapGeneration.BlockChoose(1); } else if ((SampleStepped(x, y) < heightline[2])) { visualizationCube = MapGeneration.BlockChoose(2); } else if (SampleStepped(x, y) < heightline[3]) { visualizationCube = MapGeneration.BlockChoose(3); } GameObject clone = Instantiate(visualizationCube, new Vector3(x, SampleStepped(x, y) * visualizationHeightScale, y) + transform.position, transform.rotation); clone.transform.SetParent(visualizationParent.transform); GeneratedObjectControl.instance.AddObject(clone); } } visualizationParent.transform.position = new Vector3(-perlinGridStepSizeX * .5f, -visualizationHeightScale * .5f, -perlinGridStepSizeY * .5f); }