How to use level streaming and nav mesh with ai

hi everyone,
if i have a blank persistant level which is always loaded and i want to stream from level 1 to level 2 but have AI on level 2 how and where do i build nav mesh? i did a course on ai in ue4 and in the course they mentioned that you can’t put them on the same level but it was unclear on what to do with that…i can stream levels no problem but what is the proper way to use level streaming and nav mesh?
thanks!!

I’m somewhat confused by the issue you’re having. You said that they mention that you can’t have them on the same level. Are you referring to that AI pawns or the NavMesh volumes? Because you’ll need to have a NavMesh volume when it streams in, and I believe that you’ll need to have the NavMesh update automatically during play. (Which can be done by going to Project Settings → Navigation Mesh → Runtime Generation)

Give that a go and let me know how it goes. I’ll have to mess with it once I’m home, otherwise I’d just look.

he has a persistant level, he has a level called ai_navigation_geo, at the begining of the course he says the ai_navigation_geo level is for the navigation…but then he says “we want to make sure our persistant level is selected…if you build your nav mesh in a different level it will crash the game or it won’t work” also he doesn’t specify where he puts the AI characters…in the persistant level? so build my nav mesh on the persistant level and put all the ai in the persistant level?? it just doesn’t make any sence…i’ve gotten everything ready for my game but don’t know where to put the ai and nav mesh because of this course has confused me, it seems to me that i should be able to have ai and the nav mesh volume in level 1 and have ai and seperate nav mesh volume for level 2? but he says it has to be on the persistant level.

Understood. You can handle this one of two ways: Either place the ai in the sublevels and they’ll load in and out with the level, but the will always respawn when leaving and coming back in, or you could have them spawn in after the sublevels load through scripting and triggers. Either way should work fine so long as you place the navmesh volume in the persistent level and have it stretch to the new areas. You’ll also need to turn on dynamic generation of the navmesh to calculate the new geometry loaded in. Do that in project settings - navigation mesh - runtime generation. Hopefully that fixes everything for you :slight_smile:

yes thank you…your explaination is perfect! now i have one more question but i’ll have to make some screen shots and try a few things out. thanks again!!

Not a problem whatsoever! Glad it was helpful for you! I’ll check in once you’ve posted screenshots for the remainder of your question :slight_smile:

hi sorry i was away for a while for the holidays and stuff. so what if i build several different levels with ai placed in different locations? i see that the nav mesh (which i have set to static) will be build and be there waiting (costing performance) in all the different locations. i have nav mesh bounds volumes on the persistant level. what is the workflow for setting up multiple levels with multiple nav mesh volumes? how do i stream those in or out? thank you!

That checkbox seems to fix my problem with 4.26.2. Question is does it hurt performance on a mobile game using dynamic runtime generation with lots (40-60) of characters.