An asset that procedurally generates dungeons in Unity3D
Two sample scenes are included, one that builds the maze out of tiles and one that builds the maze out of room prefabs. DunGen.cs generates the layout of the dungeon and maze, and DunGenPlacer.cs places the actual tiles around the map. Simply press the play button in either example scene and a dungeon will be generated.
Besides procedurally and building generating mazes/dungeons out of either tiles or prefabs, the scripts can also fill the generated dungeons with random objects. (Currently only supported for tile based dungeons)
All scripts have many options exposed to the inspector so lots of customization is possible.
Generating from code
In order to build a dungeon from code, simply call the BuildDungeon() function from either the DunGenPlacerTile or DunGenPlacerPrefab script. The full function signature is below:
public void BuildDungeon(int mapRows, int mapColumns, int minCells = 10, int numRooms = 1, int startX = 1, int startY = 1, bool printMap = false)
Big thanks to Richard Hawkes for his videos on procedural generation, and Quaternius for his amazing free 3D assets.