Equals
Determines whether this NavNode object refers to the same navigation node as another.
Read time 2 minutesLast updated 17 days ago
Definition
- Type: Method
- Namespace: Unity.AI.Navigation.LowLevel
- Assembly: UnityEngine.AIModule
Equals(NavNode)
Determines whether this NavNode object refers to the same navigation node as another.
public readonly bool Equals(NavNode other)
Parameters
A NavNode to compare this one with.
Returns
Remarks
The comparison is performed on the internal identifier of the node. Two NavNode values are equal even if they refer to a node that has since been removed from the NavMesh, because the identifier itself doesn't change. Use NavWorld.IsValid to determine whether the node is still active in the NavMesh world.
Examples
using UnityEngine;using Unity.AI.Navigation.LowLevel;public class NavNodeEqualsExample : MonoBehaviour{ public Transform other; void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation here = world.MapLocation(transform.position, Vector3.one, 0); NavLocation there = world.MapLocation(other.position, Vector3.one, 0); if (here.node.Equals(there.node)) Debug.Log("Both transforms are on the same NavMesh polygon."); }}
Equals(Object)
Determines whether this NavNode object refers to the same navigation node as another.
public override readonly bool Equals(object obj)
Parameters
An object to interpret as a NavNode and to compare this one with.
Returns
Remarks
The comparison is performed on the internal identifier of the node. Two NavNode values are equal even if they refer to a node that has since been removed from the NavMesh, because the identifier itself doesn't change. Use NavWorld.IsValid to determine whether the node is still active in the NavMesh world.
Examples
using UnityEngine;using Unity.AI.Navigation.LowLevel;public class NavNodeEqualsExample : MonoBehaviour{ public Transform other; void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation here = world.MapLocation(transform.position, Vector3.one, 0); NavLocation there = world.MapLocation(other.position, Vector3.one, 0); if (here.node.Equals(there.node)) Debug.Log("Both transforms are on the same NavMesh polygon."); }}