| Parameter | Description |
|---|---|
| node | The identifier of a node from a NavMesh surface or link. |
NavNodeType
Polygon when the node is a polygon on a NavMesh surface.Link when the node is a NavMesh Link or a generated link baked into a NavMeshData object.Undefined when the node is empty and no query has produced it.
Determines whether the NavMesh node is a polygon or a link.
Unity encodes the type in the NavNode identifier itself, so you can determine the type even after the specified node becomes invalid in the query's NavWorld. Use this method to decide whether to treat a node as a NavMesh surface polygon or as a link before you inspect its geometry.
Additional resources: NavNodeType
using UnityEngine; using Unity.AI.Navigation.LowLevel; public class GetNodeTypeExample : MonoBehaviour { void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation location = world.MapLocation(transform.position, Vector3.one, 0); if (!world.IsValid(location)) return; NavNodeType nodeType = world.GetNodeType(location.node); Color color = nodeType == NavNodeType.Link ? Color.magenta : Color.green; Debug.DrawLine(transform.position, location.position, color); } }