# Building a NavMesh

The process of creating a **NavMesh** from the level geometry is called **NavMesh Baking**. The process collects the Render Meshes ad **Terrains** of all Game Objects which are marked as **Navigation Static**, and then processes them to create a navigation **mesh** that approximates the walkable surfaces of the level. NavMesh can be created using the following methods:

To open the **Navigation Tab**, we go to the tab **Window/AI/Navigation**

<figure><img src="https://2203000093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGOxTM7Aj9oiVaIINrEkE%2Fuploads%2FdwnLiCysRYmADCh2tbIm%2FNavigation-AI_MenuItem.png?alt=media&#x26;token=1a5c657a-5510-4fa9-85df-6ea2cfd754e7" alt="" width="323"><figcaption></figcaption></figure>

1\) **Select** scene geometry that should affect the navigation – walkable surfaces and obstacles.

2\) **Check** the Navigation Static box, under the object tab of Navigation Window, to mark the GameObjects that you selected to be used in the NavMesh baking process.

<figure><img src="https://2203000093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGOxTM7Aj9oiVaIINrEkE%2Fuploads%2FMLsZ01eRErBgWSgNvrwt%2Ffotor_2023-1-18_19_43_56.png?alt=media&#x26;token=506d4ba3-3c39-4fd5-be00-03462c76d7a3" alt=""><figcaption></figcaption></figure>

The resulting NavMesh will be shown in the scene as a blue overlay on the underlying level geometry whenever the Navigation Window is open and visible.

<figure><img src="https://2203000093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGOxTM7Aj9oiVaIINrEkE%2Fuploads%2FQuhD039a8wvlG5scmi8M%2Fimage.png?alt=media&#x26;token=00d9fdfc-2bc2-418a-ab3c-fe4acb58e926" alt=""><figcaption><p>Baked NavMesh visualisation</p></figcaption></figure>

As you may have noticed in the above pictures, the walkable area in the generated NavMesh appears shrunk. The NavMesh represents the area where the center of the agent can move. Conceptually, it doesn’t matter whether you regard the agent as a point on a shrunken NavMesh or a circle on a full-size NavMesh since the two are equivalent. However, the point interpretation allows for better runtime efficiency and also allows the designer to see immediately whether an agent can squeeze through gaps without worrying about its radius.

Another thing to keep in mind is that the NavMesh is an approximation of the walkable surface. This can be seen for example in the stairs which are represented as a flat surface, while the source surface has steps. This is done in order to keep the NavMesh data size small. The side effect of the approximation is that sometimes you will need to have a little extra space in your level geometry to allow the agent to pass through any tight spots.

<figure><img src="https://2203000093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGOxTM7Aj9oiVaIINrEkE%2Fuploads%2F7BW3J4ckgvxZlRp9LtLk%2Ffotor_2023-1-18_19_49_26.png?alt=media&#x26;token=45ada7ac-fca9-4bd2-9a33-092df9863ff4" alt=""><figcaption><p>NavMesh in Project Window</p></figcaption></figure>

{% hint style="info" %}
When baking is complete, you will find a NavMesh asset file inside a folder with the same name as the scene the NavMesh belongs to. For example, if you have a scene called MainScene in the Assets folder, the NavMesh will be at **Assets/MainScene/NavM**_**esh.asset.**_
{% endhint %}
