Return back to origin path

  • A* version: [5.1.6]
  • Unity version: [2022.3.25f]
    Hi, id like to make my AiPath return back to its previous path after attacking or chasing target.
    What i use is saving remain path before targeting:

aiPath.GetRemainingPath(cachePath , out bool stale);

And after targeting ended i set saved path back:

aiPath.SetPath(ABPath.FakePath(cachePath), false);

So is it right do to or there is more better way?
Thanks!

That looks mostly correct from what I’m seeing and reading in the documentation :slight_smile: Give it a try and if you have any complications with it let us know!

For simplicity and robustness, I would recommend just saving a point for it to return to, and then assigning it to ai.destination