# Equals

> Determines whether this NavNode object refers to the same navigation node as another.

## Definition

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

## Equals(NavNode)

Determines whether this NavNode object refers to the same navigation node as another.

```csharp
public readonly bool Equals(NavNode other)
```

### Parameters

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

### Returns

| Type                                                          | Description                                                                                                                                                     |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if two [NavNode](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnode.md) objects refer to the same NavMesh node, and `false` otherwise. |

### Remarks

The comparison is performed on the internal identifier of the node. Two [NavNode](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnode.md) 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](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/isvalid.md) to determine whether the node is still active in the NavMesh world.

### Examples

```csharp
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.

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

### Parameters

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

### Returns

| Type                                                          | Description                                                                                                                                                     |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if two [NavNode](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnode.md) objects refer to the same NavMesh node, and `false` otherwise. |

### Remarks

The comparison is performed on the internal identifier of the node. Two [NavNode](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnode.md) 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](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/isvalid.md) to determine whether the node is still active in the NavMesh world.

### Examples

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