NavMesh Ignoring Instanced Static Mesh Actors Generated Through a Blueprint

Hey guys,

I put together a blueprint that generates walls for a maze-like level using Instanced Static Mesh Actors intending for my AI character to walk through the maze by using the NavMesh to find its way through. However, upon implementing the walls, the NavMesh fails to recognize them and my AI just walks stright into a wall if it encounters one. How can I get the NavMesh to “see” the Instanced walls?

1 Like

If the walls are generated at runtime then you should set the collision to block all dynamic. The navmesh should automatically update when spawned in. If not, then you could try to lerp the mesh over a few frames after you spawn it in and hope that it will pick it up. Also make sure you have Can Ever Affect Navigation checked (it’s in the pulldown in the collision section of the actor) Should be checked by default.

1 Like

Block All Dynamic is set on the mesh components as is Can Ever Affect Navigation but my NavMesh still isn’t picking them up :confused:

1 Like

I am having this issue as well

1 Like

In case someone still has this problem…

I was trying to do the exact same thing: Use a blueprint to create a randomly generated maze, but the NavMesh didn’t update so the AI characters were running into the walls.

I fixed it by adding a slight delay (0.2 secs) in the Maze’s BP Event BeginPlay node. Not sure why this works, but it does.

1 Like

This solved the problem on my end as well. Level generated with instanced static meshes. I am running 4.13

1 Like

Just to add onto this a bit for posterity, this also fixed my problem in 4.15, I added the delay node in my level blueprint just before it calls my ISM’s method, which actually does all of the loading, and it works great, not sure why it’s needed though, would love to understand that.

1 Like

possibly to do with race conditions, the order the engine loads things.

1 Like

Similar issues in 2022 using Unreal 5.0.

I resolved the problem by adding a “SetWorldLocation” node for the Instanced Static Mesh component after I had added all the mesh instances to the component. The SetWorldLocation node can have the same Transform as when it was created and should work fine. You will need to set the ISM component to be Moveable when created but you can then Set Mobility to Stationary after you have set the world location if you need it to be Stationary. This appears to cause the navmesh to rebuild correctly over the added instances.

This process also appears to work for Hierarchical Instanced Static Meshes also where the navmesh is not building over the HISM.

There may be a better way to resolve this but I’ve yet to find it.

3 Likes

I ported to 5.1 these last few weeks from 4.26 and started facing the same issue.

A couple of nuances for me is that the actors that contain the instanced mesh components doesn’t exist in the world at startup. These are spawned, and then procedural generation happens, on agency of the player.

Ultimately, simply setting the actor world location to the same location wasn’t enough to have the nav regenerate. I had to make a routine to “jiggle” all the actors back (-1,-1,-1) and forth (1,1,1) in two successive ticks for it to register correctly with nav.

It feels like, in UE5, runtime dynamic nav regeneration only looks for movement of actors, not spawning.

1 Like

Hey, just wanted to say thank you so much! I’d been looking for a solution for ages