private void OnGUI() { int padding = 5; int buttonHeight = 30; int buttonWidth = 170; int buttonCounter = 0; if (GUI.Button(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), "Generate Random Alive")) { _grid.ResetGrid(false); _grid.SetRandomAlive(50); } if (GUI.Button(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), "Invert grid")) { _grid.InvertGrid(); } if (GUI.Button(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), _running ? "Stop game of life" : "Start game of life")) { if (_running) { StopCoroutine(_runGameOfLife); } else { StartCoroutine(_runGameOfLife); } _running = !_running; } _speed = GUI.HorizontalSlider(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), _speed, 0.5f, 0.001f); if (_grid != null) { GUI.Label(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), (_grid.CurrentLayer).ToString()); } if (_grid != null && GUI.Button(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), "Remove single voxels")) { _grid.RemoveSingleVoxels(); } if (_grid != null && !_shortestPath && _startVox == null && _endVox == null && GUI.Button(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), "Select voxel")) { _shortestPath = true; _grid.ToggleColliderInactive(false); } if (_grid != null && _shortestPath && _startVox != null && _endVox != null && GUI.Button(new Rect(padding, padding + ((buttonHeight + padding) * buttonCounter++), buttonWidth, buttonHeight), "Generate shortest path")) { List <Voxel> shortestPath = PathFinding.CalculateShortestPath(_grid.Graph, _startVox, _endVox); _grid.ColorVoxels(shortestPath, _highlightMat); } }