Runtime Navigation

Dungeon Architect can generate dungeons at runtime so you get a new dungeon every time you play

This section shows you how to generate a navigation mesh on these runtime generated dungeons so the NPCs can move around

note

This section is releavant for dungeon types that use a theme file (e.g. Grid Builder, Grid Flow builder, City builder etc)

Setup Dungeon Game Object#

Select the Dungeon game object and make sure you have the `Dungeon component in it. If not add one

Make sure Enable Runtime Navigation is checked

Build Runtime Dungeon#

Setup your scene so this dungeon gets built at runtime as discussed in the section Runtime Dungeons section and hit Play

This will build your dungeon but won't build the navigation mesh, since we haven't specified the meshes that would contribute to the navmesh generation

To confirm this, do the following:

  1. Open the navigation panel from the main menu (Window > AI > Navigation)

  2. Play your game and switch to the Scene view. Now focus on the Navigation panel, you won't see a nav mesh generated

Setup Theme File#

When we spawn prefabs from the theme editor, we'll need to set a flag on all the prefabs that would contribute to the navigation mesh generation

Open the theme that your dungeon uses

Select the Ground prefab node and inspect the properties

Make sure Affects Navigation is set. Do this for all the static prefabs (Walls, doors, fence etc)

Now run the game and you'll see the navigation mesh

You don't want holes under dynamic objects like NPCs, Keys etc

Make sure you've not set them to affect the nav mesh generation