> For the complete documentation index, see [llms.txt](https://multiset.gitbook.io/multiset/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://multiset.gitbook.io/multiset/unity-sdk/navmesh-navigation.md).

# NavMesh Navigation

### 1. Import 3D Mesh from Developer Portal

Download the 3D Mesh (.glb) of a Map or MapSet from the Developer Portal and import it into Unity (under MapSpace Gameobject)

<figure><img src="/files/yOx8sTxgaHtmlJb5IkCI" alt=""><figcaption></figcaption></figure>

### 2. Add Unity NavMesh Surface component to this Mesh

Install Unity NavMesh package: **com.unity.ai.navigation**\
Select the Mesh -> **Component** -> Navigation -> NavMesh Surface

<figure><img src="/files/xatPtgUgnPYLRK48u1zv" alt=""><figcaption></figcaption></figure>

### 3. Add Unity NavMesh Surface component to this Mesh

Once NavMesh Surface component is added, adjust the NavMesh settings as per your scan under Window -> AI -> Navigation, and then select the Mesh and click on bake.

<div><figure><img src="/files/ZFmSIXY0a0SEDjwZYtQT" alt=""><figcaption></figcaption></figure> <figure><img src="/files/rLXqBVH8yKYphMIArlDx" alt=""><figcaption></figcaption></figure></div>

### 4. Check the baked surface

* Check the baked surface; the blue colour is the detected path that is used later in finding paths. You can adjust the NavMesh surface setting based on your map scan area.<br>
* In some areas of the Mesh ground might not be accurate, in those cases, place planes inside the map just slightly above the ground those planes are just used for NavMesh baking and need to be deactivated later

<figure><img src="/files/FdjJ3AOUEUaAYwiRTu1C" alt=""><figcaption></figcaption></figure>

### 5. Add a Navigation sample in NavMesh

### Attaching the Agent

To set up agent navigation in your AR or camera-based scene, you'll need to follow these key steps:

#### Camera Attachment

Attach the navigation agent to the Main Camera or the primary camera used for the AR session. This ensures the agent's navigation is synchronized with the user's device perspective.

<figure><img src="/files/Fw79L4UZ80HPDq9wEXOt" alt=""><figcaption></figcaption></figure>

#### Path Rendering

By default, agents will continuously move towards their destination. To visualize the path without actual movement, you'll need to:

1. Stop the agent's movement using the `isStopped` property
2. Use the LineRenderer component to draw the calculated navigation path

#### LineRenderer Configuration

Configure the LineRenderer to:

* Render the path's trajectory
* Customize visual properties like width and color
* Provide a clear visual representation of the potential agent movement

Unity automatically calculates the shortest path between two points. Add obstacles and modifiers to improve the pathing.

Check Unity documentation [here](https://docs.unity3d.com/Packages/com.unity.ai.navigation@1.1/manual/CreateNavMeshAgent.html) for detailed explanations of navigation.\
\
Also, check out videos of [Joshua Drewlow](https://www.youtube.com/@joshuadrewlow/videos)'s detailed explanations on Unity + NavMesh for navigation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://multiset.gitbook.io/multiset/unity-sdk/navmesh-navigation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
