Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


NavNode

Represents a compact identifier for the data of a navigation graph node.
Read time 1 minuteLast updated 13 days ago

Definition

public struct NavNode : IEquatable<NavNode>

Remarks

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

Examples

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}."); }}

Methods

Method

Description

EqualsDetermines whether this NavNode object refers to the same navigation node as another.
GetHashCodeObtains the hash code of this NavNode for use in collections.
IsNullDetermines whether this NavNode is empty of any information.

Operators

Operator

Description

operator ==Determines whether two NavNode objects refer to the same NavMesh node.
operator !=Determines whether two NavNode objects refer to different NavMesh nodes.