Error: Canceled path because a new one was requested. - A* with Movement Pack of Behavior Designer

Hi,

I have been using A* in combination with Behavior Designer and their Movement Pack and everything was working just fine, but after a couple of updates I started getting an error “Error: Canceled path because a new one was requested”. We had a discussion on possible solutions in the Behavior Designer forum but are out of ideas and they pointed me at you - maybe you can help?

I would really appreciate if you could take a look at the discussion and point me into a possible direction. A* was just wonderful when it was working, but right now my complete project is at a halt:

http://opsive.com/forum/index.php?topic=3817.0

Thank you.
Ben

Hi,

since I haven’t received a reply in 3 days, could you please state whether this is the wrong place to ask or whether it just takes more time to look into or whether there is just no solution to my problem.

Thank you.

Ben

Hi

Sorry for the late answer.
I am not too familiar with how the movement pack requests path. The error happens when a new path is requested while one was still being calculated. This is perfectly fine and will not break anything, however if you are getting it a lot that means it is starting a lot of path calculations and then just throwing away the results, which is obviously bad. One can check if a path is currently being calculated by calling the seeker.IsDone method. Is there any possibility of two behavior designer “nodes” trying to calculate paths at the same time?

Another problem is that when I try to add the Rich AI Agent + Behavior Tree to a new test object, it starts flying straight up as soon as I hit play.

That sounds like a physics issue. The RichAI component will do a raycast to place itself on the ground, however if the groundMask variable contains the layer that the unit itself is in, then the raycast may hit the unit itself and it will think it should stand on top of itself and thus fly up into the air. Try to remove the layer that the unit is in from the groundMask layer.

Thank you.

That flying problem is thereby solved.
The “new patch requested” problem persists. I get hundreds of these errors and the bot wouldn’t move. The problem is that it works fine in their test scene and stops working as soon as I add my own A*-GameObject and create my own ReCastGraph with exactly the same settings as the one originally in the test scene. Nothing is changed about the behavior tree (which is very simple indeed), just the A*-Gameobject is deleted and a new one created.

Hm… I’m not sure what the issue could be.
Are you sure the settings are the same? So you are saying that you essentially just deleted the A* GameObject and then added it again with the same settings?

Exactly, I have spend hours making sure it is exactly the same. The test scene as uploaded in their forum works fine. It starts throwing the error as soon as I delete their A* GameObject and include my own,

Have you by any chance changed the Multithreading setting?

No, but after all this time I found a difference that seems to be related to it… under settings there is debug > Path Logging… setting this to None seems to solve the problem in the test scene. I now have to go back to the project and see whether that helps there too?

I have no idea how that suddenly caused problems though, since everything was working fine for months before the problem started and it just seems to cause problems in a very specific way of using Behavior Designer. Any downside of turning this off?

Hi

Ah… well setting Path Logging to None will simply hide that warning.

Maybe you could share your project with me and I could try to debug it?

Setting Path Logging to None also solves the problem of them not moving. Without that setting, my bots are all back to normal, move around and behave as expected. With the Path Logging on, there is not only the error message but also no movement of the bots at all. Without they work as expected and don’t cancel paths any more. Maybe there is a problem of using Logging with Behavior Designer? I found that the guys over at Opsive have set it to None in all their example scenes.

Thank you for the offer - if there are any more problems related to that I would really appreciate you looking into the project. For now, I am happy to have found a solution.

Thanks again.

Ben

Huh? If logging is enabled or not really shouldn’t affect movement at all. That is very odd.

I’ll do more testing then and see if anything else has changed that could be the reason for it working again and let you know.

Indeed switching logging on in the example scenes that come with Behavior Designer doesn’t make a difference or cause any problems. But if I add the Astar Path Component to my own GameObject in that scene, the error occurs and pathfinding fails, but as soon as I deactivate the logging my bots work just fine.

Can you open the attached file? It uses Behavior Designer, their Movement Pack and AStar. It shows the described behavior:

http://www.gravitygames.de/richaiscene3.unity

BTW: I can reproduce the behavior in different projects with different versions of AStar and Behavior Designer.

If I play the scene and then set path logging to none, the error disappears and even if I then set it back to normal, the completed paths are logged and the bot works just fine. It seems to be a problem with it being active at scene start?

Hi

Do you think you could send me a PM with a unityPackage of everything that is required? I don’t use the movement pack myself and it would be error prone to try to find the exact versions that you used.