Select your preferred scripting language. All code snippets will be displayed in this language.
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
ClosenavMeshData | NavMesh object for which debug data has been deliberately collected during the build process. |
flags | Bitmask that designates the types of data to show at one time. |
Displays in the Editor the precise intermediate data used during the build process of the specified NavMesh.
See Also: NavMeshBuildSettings.debug.
#pragma strict public class NavMeshBuildDebugDraw extends MonoBehaviour { var m_NavMeshData: NavMeshData; function Start() { var bounds: var = new Bounds(transform.position, new Vector3(100.0f, 100.0f, 100.0f)); var markups: var = new List.<NavMeshBuildMarkup>(); var sources: var = new List.<NavMeshBuildSource>(); UnityEngine.AI.NavMeshBuilder.CollectSources(bounds, ~0, NavMeshCollectGeometry.RenderMeshes, 0, markups, sources); var settings: var = NavMesh.GetSettingsByID(0); var debug: var = new NavMeshBuildDebugSettings(); debug.flags = NavMeshBuildDebugFlags.All; settings.debug = debug; m_NavMeshData = new NavMeshData(); UnityEngine.AI.NavMeshBuilder.UpdateNavMeshDataAsync(m_NavMeshData, settings, sources, bounds); } function OnDrawGizmos() { NavMeshEditorHelpers.DrawBuildDebug(m_NavMeshData, NavMeshBuildDebugFlags.Regions | NavMeshBuildDebugFlags.SimplifiedContours); } }
using System.Collections.Generic; using UnityEditor.AI; using UnityEngine; using UnityEngine.AI;
public class NavMeshBuildDebugDraw : MonoBehaviour { NavMeshData m_NavMeshData;
void Start() { var bounds = new Bounds(transform.position, new Vector3(100.0f, 100.0f, 100.0f)); var markups = new List<NavMeshBuildMarkup>(); var sources = new List<NavMeshBuildSource>(); UnityEngine.AI.NavMeshBuilder.CollectSources(bounds, ~0, NavMeshCollectGeometry.RenderMeshes, 0, markups, sources);
var settings = NavMesh.GetSettingsByID(0); var debug = new NavMeshBuildDebugSettings(); debug.flags = NavMeshBuildDebugFlags.All; settings.debug = debug;
m_NavMeshData = new NavMeshData(); UnityEngine.AI.NavMeshBuilder.UpdateNavMeshDataAsync(m_NavMeshData, settings, sources, bounds); }
void OnDrawGizmos() { NavMeshEditorHelpers.DrawBuildDebug(m_NavMeshData, NavMeshBuildDebugFlags.Regions | NavMeshBuildDebugFlags.SimplifiedContours); } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information