Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

NavQueryBuffer.Equals

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public bool Equals(NavQueryBuffer other);

Parameters

Parameter Description
other A NavQueryBuffer to compare this one with.

Returns

bool true if the two NavQueryBuffer values refer to the same underlying pathfinding buffer, and false otherwise.

Description

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

The comparison checks whether both values point to the same allocation in memory. Two NavQueryBuffer instances that were created by separate calls to the constructor are never equal, even if their maxNodesToVisit values are identical.

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();
    }
}

Declaration

public bool Equals(Object obj);

Parameters

Parameter Description
obj An object to interpret as a NavQueryBuffer and compare this one with.

Returns

bool true if the two NavQueryBuffer values refer to the same underlying pathfinding buffer, and false otherwise.

Description

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

The comparison checks whether both values point to the same allocation in memory. Two NavQueryBuffer instances that were created by separate calls to the constructor are never equal, even if their maxNodesToVisit values are identical.

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();
    }
}