Procedural-Cave-Generation
Procedural-Cave-Generation copied to clipboard
Move map generation to design-time instead of run-time
I added Generate, Clear, and Save Mesh buttons to the inspector panel of the MapGenerator to facilitate creation of prefabs and allows the use of NavMesh. The project no longer has to be run to generate the map, instead the map objects are created by the dev by clicking these buttons and tweaking the UI. This required a little refactoring, here's the detail on it:
- MeshGenerator is no longer a MonoBehaviour.
- MapGenerator creates a temporary MeshGenerator to do the mesh and collider creation, and then drops the reference. It also no longer stores an int[,] map. This means that all the state cruft created as part of the generation process should clean up and get gc'ed, so it won't impose any sort of overhead on the map GameObject and design or run-time.
- Cave and Wall GameObjects and MeshFilters are now created dynamically, so the existing ones have been removed from the sample scene.