[Tutorial] How to Stream AI and Navmeshes in Level Streaming

Having problems with getting your AI characters and Navigation to load properly with Level Streaming? Do you find yourself loading in your streaming level with all of your AI characters, only to have them stand in place and not go anywhere? Well after much fiddling around, reading through old posts, and a whole lot of trial and error, I finally figured out how to get AI characters to work properly in Level Streaming! I noticed a ton of other people were having similar issues, and no one seemed to really have a real concrete solution for it. However, I think I managed to find one, so here’s a step by step guide on how I achieved this.

Step 1: In your Project Settings, go to “Navigation Mesh,” and set the Runtime Generation from “Static,” to “Dynamic.” This allows the Navigation building to compensate for the constant loading and unloading of Sub-Levels.

Step 2: Also in your Project Settings, go to “Navigation System,” and scroll down to “Navigation Enforcing.” Check the box that says “Generate Navigation Only Around Navigation Invokers.” I’ll go into more about what this does a little later.

Step 3: This part’s very important. Grab yourself a Navmesh Bounds Volume, and make sure you put it in The Persistent Level. Then make sure the Navmesh covers the entirety of your game world. “But gamemaster,” you might say. “Won’t building the navigation for the entire game world at once completely overload your PC, as well as Unreal Engine as a whole?” Why yes, yes it would! But luckily, there’s a little work around for that!

Step 4: It’s time to go into your AI character now, and you’ll want to add a component called a “Navigation Invoker.”

Step 4.0 - Navigation Invoker

What this does is it sets a radius around your AI character, and Navigation will be built around that radius in real time. This way, instead of overloading your PC by building the entire game world’s navigation, it will instead only build the navigation that is needed for your AI character to function. As your character walks around, new Navigation will be built near the areas that it’s approaching, while navigation it’s walking away from will be removed.

With the Navigation Invoker highlighted, set the radius to whatever you want on the panel to the right. I set mine relatively high to compensate for how far the player has to run away from the enemy before they give up chasing them.

Step 4.5 - Invoker Settings

And with that, your AI now has the capability of navigating through your Level Streams! Navigation will be built and unbuilt dynamically as you load and unload your streaming levels, and your AI character should be able to traverse around them without any issue. Here’s the final result!

AI Level Stream Success

ONE LAST THING: On your AI character, make sure to select it’s capsule component, and turn off “Can Ever Affect Navigation.”

Step 5 - Disable Can Ever Affect Navigation

If you don’t do this, the Navmesh will register the AI character as an obstacle other AI’s have to maneuver around, creating a rather bizzare effect where the AI basically has a stroke trying to get around, because the Navmesh is constantly trying to rebuild itself directly on top of the character. And we don’t want that. :stuck_out_tongue:

Can Affect Navigation Example

So yeah, that’s it! That’s how I got my AI characters working properly in my streaming levels. Hope this helps some of you out there, cause it seems like no one really found a solid solution for this issue. Thanks for reading everyone, and I hope this helped you solve your AI level stream conundrums. :slight_smile:


DUDE, thank you so much

No problem! Glad I could help. :smile:

Thanks also, really useful :smile:

Hi !

The global navmesh was making my editions really slow when I was loading my levels, so after few settings watched in the project’s navs parameters (UE5) I’ve been able to make the same with navmesh inside my sub-level !
More detail about this : In my UE5 (didn’t checked previous versions) there is options to use or not the nav that exist inside loaded levels.

► Because in my project it generate random tile of map, so making an infinite big navmesh wasn’t really possible ^^

I’ve not used UE5 very much yet, so I’m unfamiliar with how this method would work there. Sounds interesting though. :open_mouth:

The option to use Nav Mesh in loaded levels might be an UE5 exclusive thing, cause I don’t recall ever seeing an option like that in UE4. Sounds like it’d be easier to do it that way than with this somewhat round about way that I had to do to get AI’s to work properly in sub-levels. :stuck_out_tongue:

I don’t know why
but I need to place my ai character in separate level to load
but it working for now