Comparing new and old path

there might be a very simple but I could not find it,
how can I test if the new path I found is equal to the one I have saved?


Not sure about testing Path equivalency, but you can certainly test against the destination of a pathfinding agent. If you’re using AIPath, then you have access to AIPath.destination. I use this fairly extensively to query my pathfinding agents in order to determine where they are moving to (among other things).

Which components are you using exactly? If you have a Seeker attached, then you can use Seeker.GetCurrentPath to get the current path and query it. If you’ve written your own pathfinding/movement script and have a Seeker attached to the same component you’ll also have access to implementing OnPathComplete which will provide valuable pathing insight.

What’s the problem you’re trying to solve? Not saying there isn’t a case for testing Path equivalency, but I’ve never found myself needing to use it, and am genuinely interested in your use case.


my use case is a tower defense game in which the start and end points of the enemies are constant (for now) and I show the predicted path to the player, they can, in real time, add towers to the map, adding a tower on the path changes the path and there are a lot that happens due to the path change, the path re-calculations happens every frame (for now) when the player moves a tower, but I want to prevent anything from happening or being re-calculated every frame unless its really a new (different) path.