Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

NavQueryBuffer.operator ==

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

public static bool operator ==(NavQueryBuffer left, NavQueryBuffer right);

Parameters

Parameter Description
left The first NavQueryBuffer to compare.
right The second NavQueryBuffer to compare.

Returns

bool true if the two NavQueryBuffer values point to the same allocation, false otherwise.

Description

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

This operator is a syntactic shortcut equivalent to calling NavQueryBuffer.Equals. Use it inside expressions where the == syntax is more concise than an explicit method call. The comparison only succeeds when both values point to the same allocation in memory.

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

public class NavQueryBufferEqualOperatorExample : MonoBehaviour
{
    void Start()
    {
        using NavWorld world = NavWorld.GetDefaultWorld();
        NavQueryBuffer original = new NavQueryBuffer(world, Allocator.Persistent, 1024);
        NavQueryBuffer alias = original;

        if (original == alias)
            Debug.Log("Both variables alias the same NavQueryBuffer allocation.");

        original.Dispose();
    }
}