Dynamic navigation

BeginnerLevel designerProgrammer dynamic navigation, entities with navigation components don’t need a navigation mesh asset. Instead, the entities generate navigation meshes dynamically.

Note

navigation bounding boxes.

Enable dynamic navigation

game settings asset.

  • Navigation mesh, make sure no navigation mesh is selected. Navigation components.
  • Solution Explorer (the bottom-left pane by default), select the Assets folder.
  • Asset View (the bottom pane by default), select the Game Settings asset.
  • Property Grid (the right-hand pane by default), under Navigation Settings, expand Dynamic navigation mesh.
  • Enable dynamic navigation checkbox.

    Dynamic navigation mesh properties

    Enable and disable dynamic navigation from a script

    Example code:
    1. // Find and enable the dynamic navigation mesh systemdynamicNavigationMeshSystem = Game.GameSystems.OfType<DynamicNavigationMeshSystem>().FirstOrDefault();dynamicNavigationMeshSystem.Enabled = true;// This stops the dynamic navigation mesh system from automatically rebuilding in the folowing cases:// - loading/Unloading scenes// - adding/removing static collider components// - adding/removing navigation mesh bounding boxesdynamicNavigationMeshSystem.AutomaticRebuild = false;// ...if (/* any condition that should cause the navigation mesh to update (eg open/close door) */){ // Start an asynchronous rebuild of the navigation mesh var rebuildTask = dynamicNavigationMeshSystem.Rebuild(); rebuildTask.ContinueWith((x) => { if (x.Result.Success) { // The navigation mesh is successfully rebuilt } });}

    See also

  • Navigation groups
  • Navigation meshes
  • Navigation bounding boxes
  • Navigation components