Hello again, my actors sometimes “lock up” when searching for a path (seeker.StartPath…), and and they don’t get a path back so there is no OnPathComplete function called, meaning I can’t request a new one. Is is somehow possible to force OnPathComplete so the path finder is free to use again? Maybe somehow simulate an error message to go along with it (if (p.error == true) …)
Well, Im not sure why this is happening~ You might want to look in to OnPathComplete not being called first
But as far as errors, you could make a new thread that checks to make sure OnPathComplete is called after X time.
How are you calling your seeker.StartPath?? It would be best just to fix that issue first.
The only time OnPathComplete would not be called for a path is when another path request on the same seeker was made during the time it was being calculated.
tar
So:
Start Path 1
OnPathComplete 1
Start Path 2
Start Path 3 (when Path 2 was still being calculated)
OnPathComplete 3
You won’t receive a callback for path 2 since path 3 was requested before path 2 was completed. You will however always get a callback for the last path, which is usually what you want.
I managed to get rid of most errors. I think this one here was caused by having set the Nearest Node far too low, so when a path to a Vector3 that was outside of the graph was being searched for, it couldn’t complete the request (I think). I also just enclosed my actual gameworld with an obstale wall to make sure randomly wandering characters don’t walk outside of the level boundaries.
As of now, I still get the occasional error when, after getting a path back, checking to see if the path if actually possible to walk to:
NullReferenceException: Object reference not set to an instance of an object
Pathfinding.PathUtilities.IsPathPossible (Pathfinding.Node n1, Pathfinding.Node n2) (at Assets/Plugins/AstarPathfindingProject/Utilities/PathUtilities.cs:26)
It doesn’t lock up anymore, though.
Hi
If you get that error, that means one (or both) of the nodes passed to it were null, which happens if GetNearest returns null, which in turn only happens if either there are no walkable nodes (you should have those), or if Max Nearest Node Distance is set too low.