using UnityEditor; using UnityEngine.AI; using UnityEngine; public class NavMeshBuilder { [MenuItem("Tools/Build NavMesh")] public static void BuildNavMesh() { // 调用此方法生成导航网格 UnityEditor.AI.NavMeshBuilder.BuildNavMesh(); Debug.Log("NavMesh has been built!"); } }