StartMultiTargetPath and StartPath -- not working as expected with regards to recalculating paths

My game takes place inside of a fully destructible hex-grid based maze.

If you click on the floor, your units should go to that location.

If you click on a wall (LMB) - you should go to whichever side of the wall is closest (search up perpendicular points to the wall and then StartMultiTargetPath).

Now… this all works fine, except for one issue.

If I call StartMultiTargetPath, and then try to call StartPath at a later time – then the autoPath (recalculate dynamic) will default to the last MultiTargetPath.

I expect that the autoPath should refresh to whichever the last assigned path.

Meaning –

If I call StartMultiTargetPath(currentpos, new Vector3(){mp1, mp2), false) – and then later call StartPath(currentpos, p3)

then I want it to refresh to p3, as opposed to refreshing the path to mp1/mp2.

Is this the desired behaviour? It seems very counterintuitive to me that it would refresh to mp1/mp2 after I call a StartPath(currentpos, p3) much later…

Is there a way to work around this?

Hi

When autoRepath is enabled, that just means that it will periodically call seeker.StartPath(current position, destination) essentially.
If you use multi target paths. I would recommend that you do it like:

ai.canSearch = false; // Disable auto-repath
ai.SetPath(MultiTargetPath.Construct(...));

I’m not quite sure what you mean by “refreshing the path to”?

The problem is that I want it to auto-repath.

It’s just that I want it to auto-repath to the assigned start_path.

The desired behavior is that there is some common variable named “last_destination” and whenever I call startPath or startMultiTargetPath, it assigns the variable last_destination based on whatever the last path I started was.

Then, when it auto-repaths, it goes with the last chosen destination.

I guess that’s something I need to code in myself though, eh?

Ah. Yes, if you send a MultiTargetPath to the AIPath script, it will update the destination property to the result of that path. So any automatic path recalculations after that will go to the same destination.
This is by design.

I’d recommend that you do not use seeker.StartPath or seeker.StartMultiTargetPath at all, and instead only use ai.SetPath. When you call SetPath with your custom path later, it will also update the destination field.