Dynamic NavMesh Surface

The DynamicNavMeshSurface is a wrapper for Unity’s built-in NavMeshSurface that integrates with the Runtime Navmesh Baker system.

Add a DynamicNavmeshSurface component to every NavMeshSurface in your scene to register it with the runtime baker

It acts as the bakeable unit of geometry: each surface defines a region that can be collected and baked at runtime.

Unlike a standard NavMeshSurface, a DynamicNavMeshSurface can:

  • Register/unregister itself with the BakerCoordinator

  • Be marked dirty on demand (triggering re-bakes)

  • Show live links to the active Coordinator

  • Expose runtime registration controls in Play Mode


Overview

  • Surface Binding Wraps and references a NavMeshSurface component.

  • Coordinator Integration Registers itself with the active BakerCoordinator (if Auto Register is enabled).

  • Dirty Marking Surfaces can be marked dirty either locally or around the current center target.

  • Runtime Controls Can be registered/unregistered dynamically at runtime for procedural workflows.


Typical Setup

  1. Add a NavMeshSurface to a GameObject.

  2. Add a DynamicNavMeshSurface to the same GameObject.

  3. In the inspector:

    • Assign the NavMeshSurface to the Surface field, or click Assign from this GameObject.

    • Enable Auto Register (recommended) so the surface registers automatically with the Coordinator.

  4. Ensure a BakerCoordinator exists in the scene with a profile and center target set.

  5. At runtime, the surface will be managed automatically by the baking system.


Inspector Reference

Core Fields

  • Surface Reference to a NavMeshSurface. Required for baking.

  • Auto Register If enabled, the surface registers automatically with the active Coordinator on Play.

Status Box

  • If no surface is assigned:

    • Shows “No NavMeshSurface assigned”

    • Button: Assign from this GameObject (tries to auto-bind a NavMeshSurface)

  • If assigned:

    • Status shows “Ready”

    • Button: Ping Surface (highlights the bound NavMeshSurface in the Project/Hierarchy)

Coordinator Snapshot

Shows the state of the active BakerCoordinator in the scene:

  • Coordinator reference

  • Has Profile (bool)

  • Center Target reference

Actions:

  • Open Coordinator – Selects and pings the active Coordinator

  • Mark Dirty (Local) – Marks this surface as dirty, enqueuing a bake for its own bounds

  • Mark Dirty (Around Target) – Marks this surface dirty for a region around the current Coordinator’s Center Target, using the profile’s base bounds size

If no Coordinator is present, displays “No active BakerCoordinator found in the scene.”

Runtime Controls

Available only in Play Mode:

  • Register Now – Registers this surface with the Coordinator manually

  • Unregister – Unregisters this surface from the Coordinator


Public API

  • MarkDirty(Bounds? region) Marks this surface as dirty and enqueues a bake for the given region (or its own bounds if null).

  • Register() / Unregister() Can be called manually, but typically handled by the Coordinator.


Best Practices

  • Always pair a DynamicNavMeshSurface with a valid NavMeshSurface.

  • Use Auto Register unless you need full runtime control over registration.

  • Use Mark Dirty (Around Target) for moving targets (e.g., player/camera) to ensure relevant regions are kept up-to-date.

  • Keep surfaces modular — break large worlds into multiple surfaces so only relevant sections need baking.

  • In procedural workflows, combine with ProceduralTileManager to create and destroy surfaces dynamically.

Last updated