NavMesh Layers (Pro only)
Manual     Reference     Scripting   
Reference Manual > Settings Managers > NavMesh Layers (Pro only)

NavMesh Layers (Pro only)

The primary task of the navigation system is finding the optimal path between two points in navigation-space. In the simplest case, the optimal path is the shortest path. However, in many complex environments, some areas are harder to move thru than others (for example, crossing a river can be more costly than running across a bridge). To model this, Unity utilizes the concept of cost and the optimal path is defined as the path with the lowest cost. To manage costs, Unity has the concept of Navmesh Layers. Each geometry marked up as Navmesh Static will belong to a Navmesh Layer.

During pathfinding, instead of comparing lengths of potential path segments, the cost of each segment is evaluated. This is a done by scaling the length of each segment by the cost of the navmesh layer for that particular segment. Note that when all costs are set to 1, the optimal path is equivalent to the shortest path.

To define custom layers per project

To apply custom layers to specific geometry

To tell an agent what layers he can or cannot traverse

Note: Setting the cost value below 1 is not recommended, as the underlying pathfinding method does not guarantee an optimal path in this case

One good use case for using Navmesh Layers is:

Another relevant topic for advanced pathfinding is Off-mesh links

(back to Navigation and Pathfinding)

Page last updated: 2012-04-24