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.”
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.
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!
ONE LAST THING: On your AI character, make sure to select it’s capsule component, and turn off “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.
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.