public static void DrawBuildDebug (AI.NavMeshData navMeshData, AI.NavMeshBuildDebugFlags flags= NavMeshBuildDebugFlags.All);

파라미터

navMeshDataNavMesh object for which debug data has been deliberately collected during the build process.
flagsBitmask 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.

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>(); UnityEditor.AI.NavMeshBuilder.CollectSourcesInStage( bounds, ~0, NavMeshCollectGeometry.RenderMeshes, 0, markups, gameObject.scene, 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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961