# Equals

> Checks whether two NavQueryBuffer values refer to the same underlying pathfinding buffer.

## Definition

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

## Equals(NavQueryBuffer)

Checks whether two NavQueryBuffer values refer to the same underlying pathfinding buffer.

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

### Parameters

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

### Returns

| Type                                                          | Description                                                                                                     |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the two NavQueryBuffer values refer to the same underlying pathfinding buffer, and `false` otherwise. |

### Remarks

The comparison checks whether both values point to the same allocation in memory. Two [NavQueryBuffer](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerybuffer.md) instances that were created by separate calls to the constructor are never equal, even if their `maxNodesToVisit` values are identical.

### Examples

```csharp
using Unity.Collections;
using UnityEngine;
using Unity.AI.Navigation.LowLevel;

public class NavQueryBufferEqualsExample : MonoBehaviour
{
    void Start()
    {
        using NavWorld world = NavWorld.GetDefaultWorld();
        NavQueryBuffer a = new NavQueryBuffer(world, Allocator.Persistent, 1024);
        NavQueryBuffer b = a;

        Debug.Log(a.Equals(b) ? "Both handles share the same allocation." : "Different allocations.");

        a.Dispose();
    }
}
```

## Equals(Object)

Checks whether two NavQueryBuffer values refer to the same underlying pathfinding buffer.

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

### Parameters

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

### Returns

| Type                                                          | Description                                                                                                     |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the two NavQueryBuffer values refer to the same underlying pathfinding buffer, and `false` otherwise. |

### Remarks

The comparison checks whether both values point to the same allocation in memory. Two [NavQueryBuffer](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerybuffer.md) instances that were created by separate calls to the constructor are never equal, even if their `maxNodesToVisit` values are identical.

### Examples

```csharp
using Unity.Collections;
using UnityEngine;
using Unity.AI.Navigation.LowLevel;

public class NavQueryBufferEqualsExample : MonoBehaviour
{
    void Start()
    {
        using NavWorld world = NavWorld.GetDefaultWorld();
        NavQueryBuffer a = new NavQueryBuffer(world, Allocator.Persistent, 1024);
        NavQueryBuffer b = a;

        Debug.Log(a.Equals(b) ? "Both handles share the same allocation." : "Different allocations.");

        a.Dispose();
    }
}
```
