# SetNavMeshLayer(GameObject, int)

> Set the navmesh layer for the GameObject.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

> **Warning:**
>
> **Deprecated.** SetNavMeshLayer has been deprecated. To relate a GameObject to an area type, create a NavMeshBuildMarkup and pass it into UnityEngine.AI.NavMeshBuilder.CollectSources().
>
> **Upgrade to** [GameObjectUtility.SetNavMeshArea](/engine/6000.7/script-reference/unityeditor/gameobjectutility/setnavmesharea.md)

```csharp
public static void SetNavMeshLayer(GameObject go, int areaIndex)
```

### Parameters

**** (\[GameObject]\(/engine/6000.7/script-reference/unityengine/gameobject)): The GameObject on which to set the navmesh layer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The layer number you want to set.
