operator ==(NavLocation, NavLocation)
Checks whether two NavLocation objects have the same position and refer to the same NavMesh node.
Read time 1 minuteLast updated 21 days ago
Definition
- Type: Operator
- Namespace: Unity.AI.Navigation.LowLevel
- Assembly: UnityEngine.AIModule
public static bool operator ==(NavLocation left, NavLocation right)
Parameters
Returns
Type | Description |
|---|---|
| bool | |
Remarks
This operator is a syntactic shortcut equivalent to calling NavLocation.Equals. Use it inside expressions where the syntax is more concise than an explicit method call. Both the position and the node are compared.
==Examples
using UnityEngine;using Unity.AI.Navigation.LowLevel;public class NavLocationEqualOperatorExample : 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 not moved to a new NavMesh location."); m_Previous = current; }}