| Parameter | Description |
|---|---|
| other | A NavLocation to compare this one with. |
bool
true if both the node and the position of the two NavLocation values are equal, and false otherwise.
Checks whether two NavLocation objects represent the same position on the same NavMesh node.
The comparison checks the node identifier and the exact position coordinates. Two NavLocation values that share the same node but have slightly different positions are considered different. Use this method to compare NavLocation values instead of relying on reference equality.
using UnityEngine; using Unity.AI.Navigation.LowLevel; public class NavLocationEqualsExample : MonoBehaviour { void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation a = world.MapLocation(transform.position, Vector3.one, 0); NavLocation b = world.MapLocation(transform.position, Vector3.one, 0); if (a.Equals(b)) Debug.Log("Both samples landed on the same node and position."); } }
| Parameter | Description |
|---|---|
| obj | An object to interpret as a NavLocation and to compare this one with. |
bool
true if both the node and the position of the two NavLocation values are equal, and false otherwise.
Checks whether two NavLocation objects represent the same position on the same NavMesh node.
The comparison checks the node identifier and the exact position coordinates. Two NavLocation values that share the same node but have slightly different positions are considered different. Use this method to compare NavLocation values instead of relying on reference equality.
using UnityEngine; using Unity.AI.Navigation.LowLevel; public class NavLocationEqualsExample : MonoBehaviour { void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation a = world.MapLocation(transform.position, Vector3.one, 0); NavLocation b = world.MapLocation(transform.position, Vector3.one, 0); if (a.Equals(b)) Debug.Log("Both samples landed on the same node and position."); } }