2025-05-18 01:04:31 +08:00

6.3 KiB

Navigation debug visualization

To better understand the navigation space and the behavior of the NavMeshAgents acting in your scene, we provide ways to visualize the different navigation-related states.
The central tool enabling you to display this information is the AI Navigation Overlay.
You can also find some settings to tweak the debug display in your editor's preferences.

Debug visualization overlay

Within Unity's scene view overlays, we've added a specific one to control the navigation debug visualization.

This overlay is enabled and docked by default in the scene view top toolbar.
NavDebug_defaultOverlayLocation

You can control the overlay availability like you would for any overlay. See the Overlay section in the manual.
The navigation overlay is named AI Navigation.
NavDebug_overlayInMenu

Overlay control parameters

NavDebug_expandedOverlay

Section Parameter Function
Surfaces List of parameters controlling the way NavMeshSurface instances are displayed.
Show Only Selected When this option is enabled, only surfaces part of the current scene selection hierarchy are displayed.
Opacity can be set depending on the surface's selection state using the preferences.
Show NavMesh Display navigation meshes for the relevant surfaces.
The colors used to display this mesh are the ones defined for the area types.
Show HeightMesh Display HeightMeshes (surface precise elevation information) for the relevant surfaces.
Agents List of parameters controlling the displayed information for the currently selected NavMeshAgent instances.
Show Path Polygons NavMesh polygons part of the agent's path are displayed in a darker color.
Show Path Query Nodes Path nodes explored during the pathfinding query are drawn in yellow.
Show Neighbours Display the collision avoidance neighbours (dynamic obstacles) relative to the agent.
Show Walls Display the collision avoidance walls (static obstacles) for an agent.
Show Avoidance Show the different positions sampled during the collision avoidance process.
Obstacles List of parameters controlling the displayed information for the currently selected NavMeshObstacle instances.
Show Carve Hull Display the convex shape that will be used to carve the NavMesh.

These parameters are controlled by the overlay but saved as user's editor preferences and kept in between Unity's session.

Debug visualization preferences

In the Editor Preferences window, you can find a few options to customize the debug visualization.

NavDebug_preferences

Parameter Function
Selected Surface Opacity Opacity of the displayed meshes (NavMesh and HeightMesh) for NavMeshSurface instances that are part of the current selection hierarchy.
Unselected Surface Opacity Opacity of the displayed meshes (NavMesh and HeightMesh) for NavMeshSurface instances that are outside of the current selection hierarchy.
Height Mesh Color Color used to display the NavMeshSurface precise elevation information or HeightMesh.
Action
Reset to Defaults Set all the NavMesh Visualization Settings parameters to their default value.