# NavQueryStatus

> Bit flags representing the resulting state of NavWorld operations.

## Definition

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

```csharp
[Flags]
public enum NavQueryStatus
```

## Remarks

The main values are `Success`, `Failure` and `InProgress`. A status usually has only one of these main flags set. Unity sets the secondary flags (details) when it encounters specific issues during the operation. Apply `StatusDetailMask` as a bitmask to retain only the active secondary flags.

## Examples

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

public class NavQueryStatusDetailMaskExample : MonoBehaviour
{
    public Transform target;
    NavWorld m_World;
    NavQueryBuffer m_Buffer;

    void OnEnable()
    {
        m_World = NavWorld.GetDefaultWorld();
        // Deliberately small so the query is likely to run out of node budget and set a detail flag.
        m_Buffer = new NavQueryBuffer(m_World, Allocator.Persistent, 4);
    }

    void Update()
    {
        NavLocation start = m_World.MapLocation(transform.position, Vector3.one, 0);
        NavLocation end = m_World.MapLocation(target.position, Vector3.one, 0);
        if (!m_World.IsValid(start) || !m_World.IsValid(end))
            return;

        NavQueryStatus status = m_World.BeginFindPath(m_Buffer, start, end);
        if ((status & NavQueryStatus.InProgress) != 0)
            status = m_World.ContinueFindPath(m_Buffer, 10, out int _);

        // Keep only the detail flags (Success, Failure and InProgress bits are cleared).
        NavQueryStatus details = status & NavQueryStatus.StatusDetailMask;

        // Keep only the main status flag by masking off every detail bit.
        NavQueryStatus main = status & ~NavQueryStatus.StatusDetailMask;

        if ((details & NavQueryStatus.MaxNodesToVisitExceeded) != 0)
            Debug.Log("The pathfinding buffer was too small; increase maxNodesToVisit.");

        Debug.Log($"Main flag: {main}, detail flags: {details}");
    }

    void OnDisable()
    {
        m_Buffer.Dispose();
        m_World.Dispose();
    }
}
```

## Fields

| Value                                                                                                                             | Description                                                                                            |
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| [Failure](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/failure.md)                                 | The NavWorld operation didn't complete successfully and produced no usable result.                     |
| [InProgress](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/inprogress.md)                           | The NavWorld operation has started but hasn't yet finished and requires additional calls to advance.   |
| [InvalidParameter](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/invalidparameter.md)               | A parameter didn't contain valid information, useful for carrying out the NavMesh query.               |
| [MaxNodesToVisitExceeded](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/maxnodestovisitexceeded.md) | Query ran out of node stack space during a search.                                                     |
| [MoreDataAvailable](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/moredataavailable.md)             | The output buffer provided to the query was too small to hold all the results.                         |
| [PartialResult](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/partialresult.md)                     | Query didn't reach the end location, returning best guess.                                             |
| [StatusDetailMask](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/statusdetailmask.md)               | Bitmask that has 0 set for the Success, Failure and InProgress bits and 1 set for all the other flags. |
| [Success](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/success.md)                                 | The NavWorld operation completed successfully and produced a valid result for the caller to consume.   |
