| Parameter | Description |
|---|---|
| left | The NavLocation on the left side of the operator. |
| right | The NavLocation on the right side of the operator. |
bool
true if the two NavLocation values differ in node or position, false otherwise.
Checks whether two NavLocation objects differ in position or refer to different NavMesh nodes.
This operator is a syntactic shortcut equivalent to negating the result of NavLocation.Equals. Use it inside expressions where the != syntax is more concise than an explicit method call. Any difference in the position or node makes the two values unequal.
using UnityEngine; using Unity.AI.Navigation.LowLevel; public class NavLocationNotEqualOperatorExample : MonoBehaviour { NavLocation m_Previous; void Update() { using NavWorld world = NavWorld.GetDefaultWorld(); NavLocation current = world.MapLocation(transform.position, Vector3.one, 0); if (current != m_Previous) Debug.Log("Agent has stepped onto a new NavMesh location."); m_Previous = current; } }