How to visualise the path?

Hi

Before moving to A* I was using Unity Navmesh. Using Navmesh I was able to visualise the path to the player using the NavMeshPath type which converted nicely to a series of line positions.

Is there a similar way to visualise the A* path for an agent? Ideally a way I can get the path as a series of vector3s or as a NavMeshPath which I can then pass to my existing functions?

This is what I was using

void DrawPath(NavMeshPath path)
{

    line.positionCount=path.corners.Length; //set the array of positions to the amount of corners

    for (int i = 0; i < path.corners.Length; i++)
    {
        line.SetPosition(i, path.corners[i]);
    }
}

Called using….

DrawPath(agent.path);

Olly

Yes, Path.vectorPath is what you’re looking for :slight_smile:

Thanks.

And is seeker.pathCallback the right way to find out when a new path has been calculated? I see it’s depreciated but is still used in examples in the docs. I actually found an example that appears to do exactly what I need but doesn’t seem to work as the pathCallback is never called.