What is the proper setup if I have a persistent level with a sub level and I want to have navigation on the sub levels? I have tried dynamic nav meshes and the nav never loads after getting to the sub level from the persistent master level.
Can some one tell me the proper way to set it up in 4.22? I have tried dynamic and static nav meshes to no avail.
A way that did work for me “for now UE4.25”. My setup is using world composition with 100 tile streaming levels, that each consists of several sub levels for contents. I may have 4 streamed levels loaded at the same time and the nav-meshes need to fit into a persistent dummy nav-mesh. All nav-mesh are static and manually build.
- Place NavVolumes in streaming levels.
- Recast actors should be only in P-level. If you not have one, just add a new NavVolume in persistent level and then delete the same NavVolume.
- Set Recast actor “Runtime Generation” property set to “Static” to avoid stalling.
- Each NavVolume should be sized to cover geometry in own level, not the whole world. Use brush settings, not scale.
At least one dummy NavVolume has to be in P-level covering the whole world, even if it does not have any geometry. This is important due to all streamed static NavVolumes will be put there.
Enable Fixed Tile Pool Size, this is for level streams (increase value until covering area and multiply with max number of streamed simultaneous levels). I ended up with 12000*4=48000. This is important otherwise all streamed nav-meshes will not fit and your npc’s will not move in some areas. If you change this, rebuild all your nav-meshes.
- Disable automatic nav-mesh updates in the editor, build from Build->Build Paths menu (much faster then automatic).
- When you build a nav-mesh with sub levels, open that sub level and all it’s sub levels to visible. Be sure you close neighbor levels before build, otherwise build may affect neighbor NavVolume.
Enable “Force Rebuild on Load”. This is important to fill the dummy NavVolume with the streamed nav-meshes at runtime. Rebuild is not the same as recalculate, it just gather streamed static nav-meshes into dummy NavVolume.
The workflow when you see a nav-mesh not working in a streaming level
- Increase Fixed Tile Pool Size
- Open streaming level and all it’s sub levels in editor
- Rebuild nav-mesh with Navigation Build Paths
- Save all
- Close all levels
Tip: Water plane mesh need “Can Ever Affect Navigation” disabled otherwise you will have nav-mesh on waterbed and water surface, that waste Fixed Tile Pool Size.
Thank you very much for this, I will give it a try. We are hard locked to 4.19 because I couldn’t find a way around this hahaha. I will mark this as the answer and try it myself in a few days. I really appreciate it.
load persistent level, load sublevel and add NavMesh to sublevel (setup it as u like). Go editor preferences - search “Nav” - scroll down and uncheck “Update navigation automatically” - save all (important).
Done, now u have usual NavMesh field, that will load and unload with sublevel, without unnecessary generation.
If u want to regenerate it - load level with NavMeshes - check "Update navigation automatically - save all - after regeneration uncheck it back and save all again.
My solution in 4.23.1 is that all Navigation Mesh Volumes should to be at the P-Level instead of the sub-levels.
And the RecastNavMesh Runtime has to be in “Force Rebuild on Load = true” and “RuntimeGeneration = Dynamic”.
With that it going to detect the new geometry when Sub-levels have been loaded. Beside with Nav Modifier Volume within the sub-levels I limit the areas that Nav Volume overlaps geometry areas that i don´t want toalt text be walkable.
I noticed there there are many “fixes” for this, I am working on a VR game, is your 2019 way the least expensive for the engine?
I tried your way but my AI doesnt move to the sub level
I have tested this and can confirm that this is a valid approach, It is working on my current builds in UE4.23. Fantastic!
Recast nav actor should be created automatically when you put out nav mesh volume. Recast nav actor contains parameters that you can find in project settings and may be adjusted without changing project settings. Project settings are defaults and a level may have its own settings via recast nav actor.
Unfortunately, that doesn’t work for me. I don’t have a recast nav actor either. What is a recast nav actor? Is this my opponent’s spawn actor?
Yea, I have been using this method since I marked it, I have tested this on UE4.24 and now UE4.25 and it is still working correctly. I have noticed some issues where if you package your game and the Nav mesh is not present, then the package may not have cooked your map. However that is another issue. Feel free to reach out to me and ill see if I can assist.
Great you success to 4.25! I did have some issues so I have to change my workflow a bit. I guess it will solve your cooking issues as well. Please see my updated list. cheers!
Thx, the recast actor was the solution
@Swe08 hopefully you’ll catch this. We’ve got a slightly different usecase so I don’t believe no. 8 is viable. We’re currently generating a procedural dungeon via level streaming (could have the same sub-level placed multiple times), and their locations in the world aren’t known in advance. If we have navmesh generation set to dynamic, everything works perfectly just with a few settings changes on the recast in PIE. However, as soon as we make a dedicated server build and connect to it in the wild - no navigation at all.
I’ve been banging my head on this one, I tried your way for my 16 test tiles and it worked initially but at some point it stopped working. Now after build paths it doesn’t show any navigation at all.
And it general I can’t quite figure out how and when it’s working and when it’s not, seems pretty random.
So if it has built before, you may run into an issue where it doesn’t want to rebuild in a packaged game. Make sure to go into your sublevels and delete any recast nav nodes, then go to your main level and rebuild the nav mesh. Also I would turn off the automatically build nav checkbox in the editor settings. Whenever i make changes to the sub levels, if I accidentally press play, then that checkbox will rebuild the nav and create a recast nav node in the scene. To be honest it will do that even with that box unchecked but worth a try. i am on 4.25.1 source and this method works but yea sometimes it can be a pain to get it to rebuild. One way to test is to launch a standalone game from your persistent level and turn on nav using commandline. If you see green then you know it built and will be built if you package.
Long winded comment, but I hope that helps.
No matter how I try to apply this it doesnt work for me. Some things are a bit unclear and I’m finding no documentation on this. It works fine with Dynamic but this is such overkill for 1 single rebuild.
My situation is I have a level with several variations (lighting, meshes) in sublevels. When the map loads at begin_play I load a random variation. The problem is the navmesh does not update and I get the wrong one.
From your description: I added 3 nav volumes. 1 in persistent level that is the size of the full level. Then one in each sublevel variation that encompasses all the stuff inside that.
After that I rebuild paths? While in the persistent level and with all sublevels visible? (I have tried all variations of this, nothing worked)
Then once I have my recastnavmesh I go to details and enable the settings you mentioned like tile pool size.
In the end I should have 3 navbounds and 1 recastnavmesh correct? And when I play it should update? It just doesnt, never, unless I put it to dynamic.
This has been frustrating me for a bit, any help is super appreciated.
Thanks for response! I found that I can build navmesh for the entire area if make persistent level invisible while building paths. Navigation still invisible until I make persistent level visible again - that’s when navigation becomes visible.
If I build navmesh separately for each tile, tiles appear as disconnected - there’s a line at level borders, even though navmesh volumes are tightly placed together.
So I have to build navmesh for everything at once which is very different from your workflow.
How do you connect navmeshes if you build each tile separately? Did I miss something?
I’m still struggling like you, but it basically it works like this for me:
Make giant all encompassing navmesh in persistent level. Make a single navmesh for each tile. But you don’t need multiple navmeshes in each level, just single navmesh for each tile and it’s sublevels.
That tile navmesh is basically pointing where tiled mesh will be stored.
Recast actor has to be in persistent level with Fixed Tile Pool Size and Force Rebuild on load.
Then make persistent level invisible (IMPORTANT!) (eye icon) and load all your levels, press build paths and you might need to adjust Tile Pool Size and tile size in recast actor to fit your world.
It works fine for my test landscape of 16 small tiles. The reason I’m still struggling is because I don’t think it will be possible for 4000 tiles. Pretty sure I can’t load 4000 levels at at once.
So I’m trying to come up with the way to generate paths for each level separately and I don’t know yet how.
My nav-meshes are disconnected between tiles. I use AI move to with nav-mesh, and if it fail then I use move to without nav-mesh to cross the edge and then continue with nav-mesh movement, so I support a gap.
yeah persistent level should not have any navigable geometry. I just have directional light, sky, etc there