Represents a compact identifier for the data of a navigation graph node.
It is used in NavWorld operations for pinpointing and accessing relevant nodes in the NavMesh or NavMesh Links. Each node can be used by only one type of agent.
This identifier becomes invalid once the node is removed from the NavMesh, either by completely removing the surface or by modifying the surface in the node's immediate vicinity.
For more information about the surfaces that nodes describe, refer to Walkable Areas.
Additional resources: NavWorld.IsValid
using UnityEngine; using Unity.AI.Navigation.LowLevel; public class NavNodeExample : MonoBehaviour { void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation location = world.MapLocation(transform.position, Vector3.one, 0); if (!world.IsValid(location)) return; // The NavNode is the handle through which NavWorld looks up the underlying polygon or link. NavNode node = location.node; NavNodeType type = world.GetNodeType(node); int agentTypeId = world.GetAgentTypeIdForNode(node); Debug.Log($"Standing on a {type} node baked for agent type {agentTypeId}."); } }
| Method | Description |
|---|---|
| Equals | Determines whether this NavNode object refers to the same navigation node as another. |
| GetHashCode | Obtains the hash code of this NavNode for use in collections. |
| IsNull | Determines whether this NavNode is empty of any information. |
| Operator | Description |
|---|---|
| operator != | Determines whether two NavNode objects refer to different NavMesh nodes. |
| operator == | Determines whether two NavNode objects refer to the same NavMesh node. |