Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

NavNodeType

enumeration

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

The types of nodes in the navigation data.

Geometrically, navigation data is made up of polygons and segments connected together. Polygon nodes describe the walkable surfaces that an agent moves across, while link nodes describe the point-to-point connections between two positions on those surfaces. Use NavWorld.GetNodeType to determine which of the two a given NavNode represents.

Additional resources: NavWorld.GetNodeType, NavMeshData, NavMeshLinkData

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

Properties

Property Description
UndefinedRepresents a node that has no type, because the NavNode is null.
PolygonRepresents a node in the NavMesh that is a single surface polygon.
LinkRepresents a node in the NavMesh that is a point-to-point connection between two positions on the NavMesh surface.