In this guide we will enable open world navigation in Unreal Engine 4 using the Navigation Invoker system.
One annoyance that most developers forget to think about when creating open world or procedural levels is the navigation system taking hours to generate the nav mesh.
Using navigation invokers, we can generate the nav mesh during runtime without a long wait in the editor.
Before we Start
To enable these features, dynamic pathfinding must be enabled to allow the navigation mesh to generate during runtime.
To learn how to enable dynamic generation during runtime click here for our guide.
Only the areas of the level that possessed pawns are near will be generated.
To enable this setting we must firstly go to the project settings.
Once the project settings are open, click on the Navigation System tab.
Tick the checkbox named: Generate Navigation Only Around Navigation Invoker.
This tells the engine to only generate around actors that have the navigation invoker component.
To enable navigation generation on an actor, we first need to add the Navigation Invoker Component.
To add this to your actor, click the Add Component button in the top left of your blueprint editor and search for Navigation Invoker.
Once this component is added, setup the radius that the navigation mesh will be generated and removed.
From my testing, the default values work well for open world landscape levels.
When creating a procedurally generated indoor level, I recommend slightly higher values.
This prevents the actor from being trapped in their current room or area.
Demonstration and Example Files
That is all for enabling open world navigation in Unreal Engine 4!
Characters and pawns can now traverse large open or procedurally generated levels.
For further reading into the navigation functions in Unreal Engine, click here for the official documentation.