Currently, the PathfindingService NavigationMesh does not get removed or updated in real time when models get removed or destroyed. This has led to multiple NavigationMeshes overlapping onto each other, causing serious issues with the pathfinding in my game. The NavigationMesh itself is being recreated each time for new models, and the algorithm works fine, but the previous NavigationMesh is not removed or transfered to the new model. This results in the Pathfinding becoming confused on which NavMesh to go off of, leading to the enemies in my game attempting to run into walls that they shouldn’t, or avoid open areas that they can clearly progress through.
I would like to also add that this issue started occurring about 3 days ago, without the alteration of any maps or AI changes to my enemies. It just broke one day and has been persistent ever since.
An example of this can be shown below:
System Info:
CPU: Intel i5-10600k @4.10GHz
GPU: Nvidia Geforce GTX 1660 SUPER
Memory: 32 GB
Expected behavior
The NavigationMesh should automatically update in real-time and be destroyed/updated when it doesn’t find any terrain/parts to pathfind onto.
I was just testing in Studio, and it seems like the NavMesh is actually getting updated real-time now. It still isn’t being removed when the model/map gets removed (which I assume is a performance safety feature), but it IS being updated, which hopefully should solve the Pathfinding issues. I’m not too sure if the engineers even saw this post, so I’ll keep this up just until either it’s confirmed, or it isn’t an issue anymore 100%.
Thanks for your report, and we’re sorry for the delay in getting back to you. I’m just checking in to see if this problem is still occurring. If it is, could I trouble you for a repro file to allow us to investigate the behavior you are seeing?
Yes, this is still very much an issue to this day. As far as I’m aware, this issue is persistent across all experiences when a model gets destroyed. I can try and recreate the issue in a blank baseplate place file and then send it over if that works. At the moment I’m a bit busy with classes, but I wanted to pop in here and acknowledge your response.
Thanks for letting us know this is still an issue. We will investigate this further; if at a later date you’re able to create a repro file demonstrating this bug, you are welcome to update this report at any time and we’ll take a look. Any detailed repro steps you are able to share are also appreciated.
I’ll see what can be done in the meanwhile with the examples you’ve provided. Thanks again for your report!
I’ve made a few posts about PathfindingService’s memory issues with how the Navigation memory always seemed to climb. I hadn’t guessed it could be a bug like this, as I’ve read a lot of mixed responses from admins about how the NavMeshes are never cleared, but I guess now it is a bug.
I’ve had this behavior happen to me on a blank baseplate, using just the example code provided in the official documentation. This is probably amplified on more complex maps, but it looks like it just happens whenever CreatePath() is called.
My game used PathfindingService along with 100s of NPCs and the only problem I ever had with it was the extreme Navigation memory climb over time, even after lots of time spent trying to optimize its usage.
A couple days after you posted a reply, the issue just stopped occurring for about a week for whatever reason. However, it seems to have started happening once again as of today.
What I’ve found is regardless of whether or not PathfindingUseImprovedSearch is on or off, the same issue occurs. I think the best solution to this ongoing issue would be to allow the proper tools to configure the NavMesh API, as suggested by Marioman73, having a ClearNavigation method would be super useful in scenarios like this. Currently we have no API related to the NavMesh.