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

The input compile step involves gathering together all the resources needed to build the navigation mesh. This may be as simple as compiling the source geometry into the correct format, or it may be very complex, such as gathering off-mesh connections, mapping triangle type to area, gathering custom processors, etc.

The results of this step are the InputGeometry, ProcessorSet, and ConnectionSet objects. (Though finalization of the connection set can be delayed to a later step.)

There is no standard implementation for compiling the input since the process is specific to the design environment. In Unity the input is gathered from various project assets and scene objects, such as mesh filters. In other environments it might be gathered directly from Maya or 3DSMax data.

Input Geometry

The InputGeometry object consists of standard triangle mesh data (vertices and indices) with additional triangle area assignment. It is derived from the source geometry.

The InputGeometryCompiler and InputGeometryBuilder classes are used to create the input geometry object.

Each triangle in the input geometry is assigned an area based on surface type. Usually, triangles are assigned a default area, such as MaxArea, then special triangles are assigned special areas as needed. For example, 'meadow' and 'sidewalk' triangles may be the default area, while 'water' and 'swamp' triangles are assigned to other areas. Assigning areas during the build process ensures that polygons are properly formed for each type of surface.

// Example: Creating a simple input geometry object.

// Where 'mesh' is a TriangleMesh object containing all of the input triangles.

// Create an area buffer that assigns the default area id to all triangles.
byte[] areas = NMGen.CreateDefaultAreaBuffer(mesh.triCount);

// Create the builder.
// All triangles with a slope over 45.5f will be re-assigned to NMGen.NullArea.
InputGeometryBuilder gbuilder = InputGeometryBuilder.Create(mesh, areas, 45.5f);

// Build in a single step.

// Get the result.
InputGeometry geom = gbuilder.Result;

The InputGeometryCompiler class can be used to combine multiple triangle meshes into a single triangle mesh, including area assignment.


The ProcessorSet contains INMGenProcessor objects used to add special behavior to the main build step. A processor may do something simple, such as applying default flags to all polygons (ApplyPolygonFlags), or something complex such as evaluating heightfield intermediates in order to auto-generate off-mesh connections.

// Example: Creating a processor set.

// There is a standard set of processors needed for almost every build.

// You can also add other processors, including custom processors of your own.

// Create the set.
ProcessorSet processors = ProcessorSet.Create(myProcessorList.ToArray());

How these processors are used is described further in The Incremental Builder topic.


The ConnectionSet defines the off-mesh connections that will be added to the navigation mesh. In some cases they are fully defined during the input build process. In other cases they are generated by custom processor's later in the build process.

The ConnectionSetCompiler can be used to dynamically compile connections for eventual inclusion in the connection set.

See Also