Grid Graph changing path results in units doing a dance (Not finding the proper path for many seconds)


I am new to this forum, so I hope this is the right place for these questions. If I should give you more information, please let me know.

I have recently tried to convert my project that was using the Brackeys NavMesh tutorial to using the A* project and Grid Graphs.

The result can be seen in the video at the link below; When changing the destination while it is on a path, the unit will serve around for a while and eventually start heading to it’s given position.

Edit 2: link was still broken. Now it is not alone on the line.

I am iterating through all of the units with a for loop and then setting the destination of the units like so:

public void setDestination(Vector3 destination) {
normalPather.destination = destination;

Where normalPather is the attached AIPath component.

The settings for the grid graph and AI path are shown in the gif and the images.

I believe that something wrong either with the settings or with the way I am setting the destinations.
Do you know why this is occurring? What changes would you recommend I make? Should I instead be using a transform as the destination?

Thanks for your help.


I can’t see anything that looks wrong right of the bat.
though a few remarks.
In your set destination function you can get rid of this SearchPath.


your AIPath is set to recalculate it’s path every 0.1 seconds

so you don’t really have to tell it to go find a path.

Second, your RotationSpeed is extremely high. 720 is definitely a large number I wonder if it overshoots the rotation.

Third your Pick Next Waypoint Dist is really small. To help you understand what it means take a look at the variable overview here:

Though I don’t think any of these really cause the issue you’re having here.
Could you further explain what normalPather is and how it’s setup ?

1 Like

Thanks for the quick response.

I tried changing the variables that you mentioned, but reducing the turn rate (360, 180 and 0.5) and increasing the Next Waypoint Dist (both 1 and 2) didn’t solve the problem, but it did change the pattern of the wave a bit.

I have linked a video here:

normalPather is just a local variable for the AIPath component. it is configured in Start and only referenced for setting the destination (on mouse clicks) and setting the speed (once, during the start).

normalPather = GetComponent<AIPath();

I am currently using Unity 2019.1.14f1, so I will try updating it and see if it resolves the issue.