Seeker path and pregenerated path not equal

I’ve implemented a path previsualization in my turn-based tactics game. When I position my mouse cursor on a valid node, a path is drawn from my unit to the node.

The problem is that the pregenerated path and the path that follows the seeker is not always the same. Both paths are valid and equally short but I want both paths to follow the same rules every time.

Here the code for the pregenerated path (summarized):

var pathLine = ABPath.Construct(startWorldPosition, MouseWorld.GetPosition(), null);


lineRenderer.positionCount = pathLine.vectorPath.Count;
for (int i = 0; i < pathLine.vectorPath.Count; i++)
    lineRenderer.SetPosition(i, pathLine.vectorPath[i] + offset);

And here is the seeker code in my move script:

seeker.StartPath(transform.position, destination, OnPathComplete);

The starting and end positions are the same in both cases, and I’d assumed the paths will be identical, but that’s not the case.

Thank you in advance!


If the start/end points are identical (make sure they really are, even small differences can make a difference), the paths should be identical. The seeker performs some post-processing of the paths, though. In particular you can change the Seeker → Start End Modifier settings. Set the snapping mode to SnapToNode in order to replicate what a path with no modifiers will look like.

It worked. The end point was not identical. You saved a big headache!

Thanks for your help!