Prefab Guidelines

Dungeon Master uses a grid-based build scale.

By default:

1 cell = 4 Unity units

This value is controlled by DungeonBuildSettings.CellSize.

Core Module Scale

Prefab Expected Size And Pivot
Floor 4 x 4 on X/Z, pivot at center, top surface around Y 0.
Wall 4 units long, pivot at bottom center, length along local X, thickness along local Z.
Open Passage Same footprint and pivot as a wall.
Door Same footprint and pivot as a wall.
Locked Door Same footprint and pivot as a wall.
Secret Wall Same footprint and pivot as a wall.

Orientation

Dungeon Master rotates wall-like prefabs when placing them.

Do not fix orientation by rotating generated prefab instances. Fix orientation inside the prefab/model source instead.

Blender Export

Recommended Blender workflow:

  1. Model with Blender's normal Z-up orientation.
  2. Apply transforms with Ctrl + A > Rotation & Scale.
  3. Export FBX with:
  4. Forward: -Z Forward
  5. Up: Y Up
  6. In Unity, keep prefab transforms clean:
  7. Position: 0, 0, 0
  8. Rotation: 0, 0, 0
  9. Scale: 1, 1, 1

Content Prefabs

Content prefabs are spawned at marker locations.

For best results:

  • Put the prefab pivot at the point that should touch the room floor.
  • Keep scale at 1, 1, 1.
  • Use marker Local Offset for small placement adjustments.
  • Add your own gameplay scripts directly to content prefabs if needed.

Door Prefabs

Door prefabs receive a DungeonDoor component automatically if they do not already have one.

You can add your own door behavior script to the prefab and read the metadata:

using DungeonMaster;
using UnityEngine;

public class MyDoorBehaviour : MonoBehaviour
{
    private DungeonDoor door;

    private void Awake()
    {
        door = GetComponent<DungeonDoor>();
    }

    public bool CanOpen(string keyId)
    {
        return !door.IsLocked || door.KeyId == keyId;
    }
}

Enemy And Boss Prefabs

Enemy and boss prefabs are spawned from content markers. Dungeon Master does not include combat AI or navigation setup.

Common integration options:

  • Use the spawned prefab as the actual enemy.
  • Use the spawned prefab as a spawn point that your own system replaces at runtime.
  • Read DungeonContentMarkerComponent to know which room the marker belongs to.

Keeping Builds Clean

Enable Clear Previous Build when iterating in the editor. This removes the previous generated child objects before creating a new dungeon.

Disable it only if you intentionally want multiple generated dungeons under the same builder object.