# Equals

> Checks whether two NavLocation objects represent the same position on the same NavMesh node.

## Definition

* **Type:** Method
* **Namespace:** [Unity.AI.Navigation.LowLevel](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel.md)
* **Assembly:** UnityEngine.AIModule

## Equals(NavLocation)

Checks whether two NavLocation objects represent the same position on the same NavMesh node.

```csharp
public bool Equals(NavLocation other)
```

### Parameters

**** (\[NavLocation]\(/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation)): A NavLocation to compare this one with.

### Returns

| Type                                                          | Description                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if both the [node](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/node.md) and the [position](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/position.md) of the two NavLocation values are equal, and `false` otherwise. |

### Remarks

The comparison checks the [node](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/node.md) identifier and the exact [position](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/position.md) coordinates. Two [NavLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation.md) values that share the same node but have slightly different positions are considered different. Use this method to compare [NavLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation.md) values instead of relying on reference equality.

### Examples

```csharp
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.");
    }
}
```

## Equals(Object)

Checks whether two NavLocation objects represent the same position on the same NavMesh node.

```csharp
public override bool Equals(object obj)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): An object to interpret as a NavLocation and to compare this one with.

### Returns

| Type                                                          | Description                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if both the [node](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/node.md) and the [position](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/position.md) of the two NavLocation values are equal, and `false` otherwise. |

### Remarks

The comparison checks the [node](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/node.md) identifier and the exact [position](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation/position.md) coordinates. Two [NavLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation.md) values that share the same node but have slightly different positions are considered different. Use this method to compare [NavLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation.md) values instead of relying on reference equality.

### Examples

```csharp
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.");
    }
}
```
