# NavMesh Surface component reference
Use the NavMesh Surface component to define and build a [NavMesh](./Glossary.md#NavMesh) for a specific type of [NavMesh Agent](./NavMeshAgent.md) in your scene. Use the available properties to specify the type of NavMesh Agent that can use the NavMesh, the area type to assign to the generated NavMesh, and the geometry to use when you bake the NavMesh.
To use the **NavMesh Surface** component, apply it to the [GameObject](./Glossary.md#gameobject) on which you want to build the NavMesh.
To apply the NavMesh Surface component to a GameObject, do the following:
1. Select the GameObject.
2. In the Inspector, select **Add Component** > **Navigation** > **NavMesh Surface**.
The Inspector window displays the NavMesh Surface component.
In the NavMesh Surface component, you can click **Bake** to generate the NavMesh for the current settings and scene geometry. The resulting [NavMesh data](./NavMeshSurface.md#navmesh-surface-asset-file) replaces any NavMesh that **NavMesh Surface** already contains, if that is the case.
A [**Scene**](./Glossary.md#scene) can contain multiple NavMesh surfaces. You can add the NavMesh Surface component to any GameObject in your scene. This is useful for when you want to use the GameObject parenting [hierarchy][1] to define which GameObjects contribute to the NavMesh. Only the NavMesh Surface components that are enabled and part of active GameObjects load their NavMesh data into the navigation system. You can unload NavMesh data from the scene by disabling either the **NavMesh Surface** that contains it or the GameObject that the NavMesh Surface is attached to.
The following table describes the properties available in the NavMesh Surface component. Use the main settings for the NavMesh Surface component to filter the input geometry on a broad scale. Use the [NavMesh Modifier](./NavMeshModifier.md) component to adjust how Unity treats input geometry on a per-GameObject basis.
Property | Description | |
---|---|---|
Agent Type | Select the type of NavMesh Agent that can use the NavMesh. | |
Default Area | Specify the area type to assign to the generated NavMesh. The area types define how difficult it is for agents to move across the NavMesh. The available options include all of the area types defined on the Areas tab of the Navigation window. There are 29 custom area types and 3 built-in area types: | |
Walkable | Make the NavMesh walkable for the assigned Agent type. (This is the default option.) | |
Not Walkable | Prevent the specified Agent type from crossing this surface unless there is a GameObject that overrides the area type. | |
Jump | This option is used for automatically generated links. For more details about area types, refer to Navigation Areas and Costs. |
|
Generate Links | Automatically generate links between objects that the NavMesh Surface collects when you bake the NavMesh. If you select Generate Links, NavMesh Surface attempts to generate links between any collected GameObjects when you bake the NavMesh. If you do not select Generate Links, NavMesh Surface doesn't attempt to generate any links between the collected GameObjects when you bake the NavMesh. Refer to the Links Generation section for more information. |
|
Use Geometry | Select which geometry to use when you bake the NavMesh. | |
Render Meshes | Use geometry from Render Meshes and Terrains. | |
Physics Colliders | Use geometry from Colliders and Terrains. Agents can move closer to the edge of the physical bounds of the environment with this option than they can with the Render Meshes option. For more information on Colliders, refer to Introduction to collision. | |
NavMesh Data | (Read-only) Locate the asset file where the NavMesh is stored. The text box displays None when the NavMesh Surface does not contain NavMesh data. The text box displays Missing if you delete the asset file from the Project window and don't use Clear first. | |
Clear | Remove the asset file where the NavMesh is stored. Use this button also when you plan to remove the component. | |
Bake | Bake a NavMesh with the current settings. When you bake the NavMesh, it automatically excludes GameObjects that have a NavMesh Agent or NavMesh Obstacle. They are dynamic users of the NavMesh and don't contribute to the process. Unity stores the NavMesh data in an asset file. The NavMesh Data property displays a reference to the asset file. |
Property | Description | |
---|---|---|
Collect Objects | Define which GameObjects to use when you bake the NavMesh. | |
All Game Objects | Use all active GameObjects in the scene. (This is the default option.) | |
Volume | Use all active GameObjects that overlap the bounding volume. Geometry that is located outside of the bounding volume but within the agent radius is included when you bake the NavMesh. | |
Current Object Hierarchy | Use the GameObject that the NavMesh Surface component is placed on and all active GameObjects which are children of this GameObject. | |
NavMeshModifier Component Only | Use any GameObjects in the scene that have a NavMesh Modifier attached to them and, if their Apply To Children option is turned on, use their child objects as well. | |
Include Layers | Select the layers for which GameObjects are included in the bake process. In addition to Collect Objects, this allows for further exclusion of specific GameObjects from the bake process (for example, effects or animated characters). This is set to Everything by default, but you can toggle options on (denoted by a check mark) or off, individually. |