Navmesh Periodically Failing to Generate on Certain Instanced Static Meshes

I’m working on a dynamically constructed level, however upon setting my navmesh to dynamic (in level and project settings both), I’m having problems whereby it just spontaneously disappears, or misshapens, or only calculates for part of the level - obviously ruining my AI?

[EDIT] After much annoyance and distress, and after migrating the game to a new project, the problems persist - however the problems do not appear to be due to dynamic navmeshes, but some other issue somewhere within all navmesh generation, as navmesh periodically fails to generate on certain areas of my randomly generated map, with no discernible reason as to why, as without making any changes to anything, it will occasionally generate properly over everything, and sometimes just over specific parts of the map.

  1. The level is using a series of different instanced static meshes to construct a building floor.
  2. I don’t know if it would, but given the fact that I haven’t edited anything related to navmesh I’d assume not.
  3. Sorry I forgot to include my images.

Hello,

  • When you say you are working on a dynamically constructed level, how exactly are you constructing the level?
  • Does this occur in a clean project as well, or is it only occurring in your own project?
  • Could you provide a .gif or video showing the issue?

Would you be able to provided a simplified test project so that we can use it to reproduce the issue on our end? You can zip up the project, upload it to Dropbox, and PM me with a link on the forums: https://forums.unrealengine.com/member.php?160394-Sean-Flint

I can’t really provide a ‘simplified’ project as the generation is quite complex - I can’t really simplify any of it unfortunately.

In this particular case, I’ve spent time trying to reproduce it in a clean project on our end, but I have not been able to see those same results. This leads me to believe there are differences between our setups.

If you’re unable to provide a simplified project, you could instead provide the project that the issue is occurring in if that’s possible.

Unfortunately, without a repro case or a test project, we’re limited as far as what actions we can take with this issue. If you are able to provide any additional information or a test project, that would be extremely helpful.

Thank you.

After updating to 4.12.5 and (obviously) restarting the engine, the issue seems to have gone - I will of course reply here if it starts again - but right now it seems fixed - thanks for trying to help :slight_smile:
(If it comes up again I’ll send you my project as it’s less than 500MB at the moment)

Nope, encountered the issue again - will PM you a link to download the project once it’s done uploading the rar.

Sorry, also can’t figure out how to PM you?

If you click the link I posted in my above comment, it will take you to my forum profile. From there, under my name, you should see the Send Private Message button.

After looking at the project, I noticed that the closed off areas will not have a Nav Mesh because they are blocked by the collision of the door. What you can do is add a smaller nav mesh bounds inside the room (any size should work) and it will also generate inside the rooms as well. I did not see a problem with it disappearing, however. Is there any way to consistently reproduce this?

The room thing isn’t an issue usually as it generates in them (sometimes it glitches and you need to make it update via moving the navmesh), and it’s dynamic so it does generate navigable area once the doors open - I encounter the issues when I try running the game fairly consistently - whilst testing my (ATM very basic ai), I run around and test where the ai follows, and it stops at some point and if I eject from player I can see the navmesh is stuffed up - no way that I’ve seen to perfectly reproduce it though.
The navmesh issue isn’t just that it only calculates a small area sometimes - when it does it can also just do it wrong, like yesterday when I saw the issue come up again, the navmesh had made navigable area through walls and weird stuff like that.

Wanted to add that after disabling navmesh blocking on the doors, the navmesh fails to build inside the rooms - this is after a new issue has arisen where the navmesh no longer builds inside rooms - also, I was wondering if there was anyway I could change it so that I can make the navmesh recalculate only when I want it to, by like calling a ‘recalculate’ function or something? Because I only need it to calculate once after the generation, not continuously.
Also have you made any progress on the prior issues of random endings of the navmesh generation, because I have also found a new issue where if I change the seed of the random generation, it generates random breaks in the navigable area from the get go, as can be seen here:

Not sure what your problem is actually about, but things I’ve learned fighting it:

1 - Keep your paths on Persistent level. Theoretically other levels should work, but the disappearing sounds familiar and that fixed it for me few versions back

2 - Yes you can force them to re-calc, the way depends on how you create them. If you’re using UNavModifierComponent (or a custom one derived from UNavRelevantComponent), then just call RefreshNavigationModifiers() on it. If you’re using some other actors inheriting INavRelevantInterface or just use plain volumes created by some script, then it takes a little bit more of work.

UNavigationSystem* NavSystem = UNavigationSystem::GetNavigationSystem(this);
	if (NavSystem)
	{
		NavSystem->UpdateNavOctreeElement(this, this, UNavigationSystem::OctreeUpdate_Modifiers);
	}

I only use dynamic modifiers and not full real-time rebuild. I also had to override those 2 functions to make it work the way I want, but I suppose if you use the regular engine volumes you won’t have to do that. There might be some refresh function for volumes, haven’t used it myself so no idea.

//~ Begin INavRelevantInterface Interface
virtual void GetNavigationData(FNavigationRelevantData& Data) const override;
virtual FBox GetNavigationBounds() const override;
//~ End INavRelevantInterface Interface

Good luck. And nothing of this is visible in BP so c++ solution only.

Thanks for your reply, but my level is already only a single persistent level, and I just need to recalculate the navmesh, not modifiers or any related components.
But thanks for replying.

Sorry Sean, I don’t mean to sound impatient, but this issue is severely impacting the rate at which I can work on this project so I’m just wondering if you’ve yet seen the issue, managed to find the source of the issue and/or found a solution?
If you haven’t yet experienced the issue I’ll be very surprised as there is no way to avoid the issue on my end.

Thanks,
Oscar

Is there a reason that you wouldn’t want the navigation mesh to be generated inside of rooms that had closed doors? I noticed once I placed the Nav Mesh volumes as I suggested in my earlier comment, it seemed to be working as expected.

The areas where I saw an issue with the nav mesh generating were always inside of a room that started out closed. When I opened the doors, the nav mesh would only generate for part of the room. Once I added a bounds volume to that room, it was already present, so I didn’t have to worry about partial generation.

Have you tried altering the Generation settings for your Nav Mesh in the Project Settings->Navigation Mesh menu? Try changing the Merge Region Size, specifically.

Regardless of whether or not the doors were closed the navmesh should generate inside the rooms, but even without that happening, as I said in a previous reply - I’ve since disabled the doors from affecting the navmesh, yet the problem persists. When I place a new navmesh into the scene, it works properly for a few dynamic builds, then begins to fail (static builds don’t work either)
I also can’t just add navmesh per room (although I have tried just for testing and it also didn’t work - it’s like there’s a 'navmesh black hole’s in each of the rooms or something - because the whole thing generates at runtime, and I can’t just add new navmesh (to my knowledge), but it should just work with 1 anyway, and as I just said also - adding individual ones doesn’t work either.

I haven’t tried editing that particular project setting, however this whole issue is definitely a bug, not an issue in my working, as it generates properly a few times then just stops.

After migrating all the content to a new project - which fixed the issue - I then began working on a new part of my system which is supposed to make the doors only affect the navmesh when they’re open, however after adding a boxcollision component to enable the ‘dynamic obstacle’ setting, the navmesh is again refusing to generate inside the rooms, even after I remove all the door blueprints from being spawned, the issue persists - leading me to believe that it hasn’t realised the level has changed?

Although I don’t understand why it would do that because in my experience, the navmesh ignores whether or not areas are reachable from another place (because why would it - it doesn’t know where you want AI to move)?

Hello,

I have reproduced your issue, and have entered a bug report, UE-33316. Thank you for your report.

Have a great day