This Unity script generates a one-room dungeon using prefabs for the floor, walls, corners, and pillars. The dungeon is randomly generated, making each playthrough unique.
- Unity 2021.3.24f1 or later
- Clone or download the repository.
- Open the Unity project.
- Open the
OneRoomDungeon
scene. - Attach the
DungeonGenerator
script to an empty game object in the scene. - Assign the required prefabs to the script variables in the inspector.
- Run the scene.
- A one-room dungeon will be generated with random floor tiles, walls, and pillars.
- Use the WASD keys or arrow keys to move around the dungeon.
- The enemy spawner will randomly spawn enemies in the dungeon.
- The navmesh baker generates a navmesh for the enemies to navigate.
dungeonSize
: The number of pillars in the dungeon.groundPrefab
: An array of floor tile prefabs.gridSize
: The size of the dungeon grid.pillarPrefabs
: An array of pillar prefabs.wallPrefab
: An array of wall prefabs.cornerPrefab
: An array of corner wall prefabs.
If you find a bug or have an idea for a new feature, please open an issue or submit a pull request. Contributions are always welcome!
This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.
These scripts were developed by Robin Cormie @ Lost Crow Games and are provided as-is without any warranty or guarantee of fitness for any particular purpose. Use at your own risk.
This project uses NavMeshComponents, developed by Unity Technologies. You can find the original repository at https://github.com/Unity-Technologies/NavMeshComponents.