This generator spawns tiles in a grid and each tile checks for collision against it when the tile is generated. The Tile class on instantiation sends out a Physics.OverlapSphere with the width of the renderer bounds to check if another tile is there. If there is, do something. In this example, we destroy the instantiated tile because another tile was there before it. Once a room is generated it is there to stay.
There are many ways to manipulate how the tiles are distributed and what kinds are laid down. By changing the x and y and the range of tiles picked from as well as the world size, all sorts of different layouts can be generated.
This is used as a base in room generation and a tutorial will follow with connecting rooms and generating content with in them.
Make a free website with Yola