Navmesh not rebuilding

I am making an RTS and have entered the phase of learning the AI component so that my “citizens” can be totally autonomous (think Tropico.) I’m at the very early stages of learning the AI system now but I am able to get characters to move across the map towards a building (mesh) that I place for “construction”; however, I have noticed a hitch. When I place the building and have the AI go to the “rally point” at the front of the building, if the AI is coming from the rear of the building, he hooks and stops moving at the mesh but the Behavior Tree keeps ticking because he hasn’t reached his destination. At first I thought it had to be my blueprints and/or behavior tree but have since realized that when I place a mesh into the world during runtime, the navmesh is not updating to accommodate the new mesh and therefore the AI never recalculates to go around it.

Having found a similar question, I saw that you need to turn on the Runtime Generation to “Dynamic” and I also checked the “Force Rebuild on Load” (tried without as well.) Neither of these solutions are currently working for me - the navmesh does not rebuild as would be expected. Is there a bug in the system or am I doing something wrong? Perhaps I need some sort of Recast node to run when the mesh is place or I’m missing another setting, although I’ve watched an Unreal Video with Ian and his works just fine with only adjusting the settings in his default.ini? I have tried this in 4.8.2 and have just upgraded to 4.8.3 but has the same effect. See my images below. Any help would be appreciated!

Bump. Can anyone help with this?

Did you set “dynamic” navmesh generation on RecastNavMesh instance on your map, or in the Project Settings? The project settings-way is the proper one. It’s a know… missing feature :wink:



Hey mieszko, thanks for the reply. I did actually set that in the project settings, I didn’t see any option on the level instance of the navmesh volume. I’m going to test it in a few minutes but I’m wondering if my “World Dynamic” collision is off in the BP; that is, if it even matters for that but figured I would test it out. Is there any other setting that I may be missing on this?

Thanks again

Mieszko, I just tested the collision and as I would assume, it made no difference. I checked and the RecastNavMesh does show it is set to Dynamic, which I never personally set it, but double checked and the project settings is also set Dynamic.

Any other solution mieszko or anyone else who may know?

I still don’t have a solution to this. Do you have any other suggestions as to what can be causing the problem @mieszkoz?

@mieszkoz alright, I’ve done some further testing and I’m thinking what I am experiencing may be a bug. Let me give more detail:

What I am currently doing in my project (an RTS similar to Tropico) is I have Parent/Child/Grandchild blueprints for my buildings and also have a “Construction Proxy” for the “pre-construction” buildings. Using this type of hierarchy, it makes it simple to not create BP’s for each and every one of my buildings by not having a mesh preassigned to the BP. In the construction script of each base BP I have it set the Static Mesh to the required mesh (depending on the building you are wanting to place.)

In my testing, I created just a basic BP with a starter content shape (pyramid) and spawned it into the world; the Navmesh recalculated properly. I took it one step further and deleted the default mesh and in the construction script I had it set the mesh to the same shape I used before. This time when the BP spawned into the world, the Navmesh did not recalculate.

I added the mesh (pyramid) back as the default and this time I used a completely different (and larger) mesh to set in construction (mind you I still have the base pyramid shape set as default) then spawned it into the world. Not only did it recalculate the Navmesh but it properly recalculated it to the new mesh I set in the construction script.

Conclusion: It appears as though in order for the Navmesh to recalculate properly, you must have a mesh assigned to the BP prior to construction, and then have the construction script change the mesh as needed.

This appears to be some sort of weird bug but at least I have found a workaround. If you do believe this is a bug then let me know and I will submit a bug report (or perhaps you can pass it on) but if you think it’s expected default behavior then I will just stick with my workaround. Thanks!

Any updates on this? I think I am having a similar issue and this work around does not work for me. Is this fixed in 4.9 or is anyone at Epic interested in making the navmesh more robust?


TBH I don’t know if it was fixed in 4.9 even though I’m using it. If you read my last post you’ll see what I had to do to fix it. I don’t think it’s really a workaround. When the BP is initialized if there’s nothing in the mesh then it won’t recognize it. I’m not sure if it’s desired functionality or not. Just add any simplistic mesh to you static mesh component and when you switch it like I do through variables then it will work just fine.

It’s a known bug that our navmesh generation has issues with static meshes set up in construction script. In general Construction Script is a special case in many sorts of ways, and we haven’t fixed it yet for navigation. Not deliberately anyway. However, there have been fixes done to handling of hierarchies of components and actors, and those should be in 4.9, and there is a chance the construction script issue would be resolved as well. Please give it a try and let me know.

Regarding a workaround, the provided one should work, but it may require the “default” mesh to be navigation relevant, meaning have relevant collision.

Alternative workaround would be to set the mesh in “Begin Play”, that should work as well.



Could you demonstrate this workaround in blueprints? I can’t seem to figure out how to do this, and I’m having the same problem.

I tested moving my code to Begin Play but issue is still there. I’m not at my PC so can’t snap SS to show you but all you need to do is set the Static Mesh component of you BP to have a generic default mesh - I used a simple sphere or the pyramid mesh (both from starter content.) Then in my construction script I have it set the static mesh component to the mesh I truly desire. If you still can’t figure it out then let me know and in the morning when I’m back in the editor I’ll snap a SS and show you what mine looks like but it really is pretty simple. Let me know

You can enforce nav mesh refresh by adding a little location transform. Even better immediately after the location change you can reverse that change - it all happens in one frame so it wouldn’t be noticed by the players.

This worked for me. It’s incredibly frustrating. I spent probably 2 days trying to track down why a blueprint with a mesh in it re-adjusted the navmesh when spawned, but my identical C++ class that assigns the mesh dynamically did not. Adding a quick location change in BeginPlay fixed it…

@mieszkoz - do you have any estimate of when this bug will be fixed, or can you give us a link to the bug/ticket so we can track why this hack is required?