[This is preliminary documentation and is subject to change.]

The Unity NMGen build process is pretty much the same as the standard build process describe by An Introduction to NMGen. The main difference is in the input compile process.

The input compile process is manged by an input builder that is modified by the scene query and input processors assigned to the NavmeshBuild asset.

The Input Compile Process

The input compile process is managed by the input builder. The the only thing the builder does is manage the input processors. At each step it makes sure all the necessary build assets are ready for use and calls the processors in ascending priority. A processor can be active during one step or multiple steps. For example, the MeshCompiler loads MeshFilter components from the scene during the load step, then triangulates them during the compile step.

Unity Input Build Process

Load Components

The scene query asset is used to determine which components in the scene will be included in the input compile. Any ScritableObject that implements the ISceneQuery interface can be used. For example, if you want the build to gather scene components based on tags, then you'll use the TagSceneQuery asset. If no scene query is provided, then the the query will be global. (E.g. All MeshFitlers in the scene, all Terrains in the scene, etc.)

During the load component step, each input processor uses the scene query to load the components that it cares about. For example, the MeshCompiler will load all MeshFilters and the TerrainCompiler will load the Terrain component.

Filter Components

During the filter component step the input processors have a chance to remove components from the input compile. The component loaders are generally dumb. They load everything the scene query let's them load. In this step, other processors can refine the result. For example, a MeshInputFilter can be used to remove MeshFilter's that reference all 'door' meshes. Or the StaticFilter can be used to remove all components not marked as static.

Apply Area Modifiers

At this point all components that will be compiled have been gathered. During this step input processors can assign custom areas to each component. The assignments will be used during the compile step. For example, the MeshAreaDef can assign the area 21 to all MeshFilters that reference swamp and marsh meshes. During the compile step the MeshCompiler will then assign 21 to all triangles generated from the meshes.


MaxArea will be assigned by default. You can use the DefaultAreaDef asset to assign a different area as the default.

Compile Input

During the compile input step the input processors will compile everything needed to create the objects required by the rest of the NMGen build process. (I.e. The InputGeometry, ProcessorSet, and ConnectionSet objects.) MeshFilter and Terrain components will be triangulated, and off-mesh connections and NMGen processors created.


At this point all data needed to create the final input objects has been compiled. During the post-process step the input processors are given the oportunity to make final adjustmwents to the data before it is locked down in the immutable InputGeometry, ProcessorSet, and ConnectionSet objects.

See Also