# ContinueFindPath(NavQueryBuffer, int, out int)

> Continues a path search that is in progress.

## Definition

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

## ContinueFindPath(NavQueryBuffer, int, int)

```csharp
public readonly NavQueryStatus ContinueFindPath(NavQueryBuffer queryBuffer, int nodesToVisit, out int nodesVisited)
```

### Parameters

**** (\[NavQueryBuffer]\(/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerybuffer)): The container used to store intermediate node data for this search operation.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Maximum number of nodes to be traversed by the search algorithm during this call.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Outputs the actual number of nodes that have been traversed during this call.

### Returns

| Type                                                                                             | Description                                                |
| ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
| [NavQueryStatus](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus.md) | A bitfield with one of the following three main flags set: |

### Remarks

The operation needs to have been initialized previously with [NavWorld.BeginFindPath](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/beginfindpath.md) and it runs until the entire route is found or the specified number of iterations have been executed.

As long as the previous call returned a state of `InProgress` this method can be called repeatedly, across different frames, until the operation is successful. Use [NavWorld.EndFindPath](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/endfindpath.md) afterwards to prepare the path data for retrieval, along with the number of contained nodes.

Additional Resources: [NavQueryStatus.StatusDetailMask](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navquerystatus/statusdetailmask.md)

### Examples

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

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

    void OnEnable()
    {
        m_World = NavWorld.GetDefaultWorld();
        m_Buffer = new NavQueryBuffer(m_World, Allocator.Persistent, 1024);
    }

    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);
        while ((status & NavQueryStatus.InProgress) != 0)
            status = m_World.ContinueFindPath(m_Buffer, 64, out int _);

        if ((status & NavQueryStatus.Success) == 0)
            return;

        status = m_World.EndFindPath(m_Buffer, out int pathSize);
        if ((status & NavQueryStatus.Success) == 0)
            return;

        NativeArray<NavNode> path = new NativeArray<NavNode>(pathSize, Allocator.Temp);
        int copied = m_World.GetResultFromFindPath(m_Buffer, path);

        // The path is a corridor of nodes, not a list of waypoints. Draw the gate that each
        // pair of consecutive nodes shares to see the corridor the agent can move through.
        for (int i = 0; i < copied - 1; i++)
        {
            if (m_World.GetPortalPoints(path[i], path[i + 1], out Vector3 left, out Vector3 right))
                Debug.DrawLine(left, right, Color.yellow);
        }

        path.Dispose();
    }

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