---
title: "Challenge 2: Create a NavMesh Agent"
content_type: tutorial
url: "https://learn.unity.com/course/beginner-ai-pathfinding/tutorial/challenge-2-configure-a-navmesh-agent?language=en"
language: en
container_type: course
container_title: "Getting Started with AI Pathfinding"
container_url: "https://learn.unity.com/course/beginner-ai-pathfinding.md?language=en"
standalone_markdown_url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en"
previous_title: "Challenge 1: Create a NavMesh"
previous_url: "https://learn.unity.com/course/beginner-ai-pathfinding/tutorial/challenge-1-create-a-navmesh?language=en"
previous_markdown_url: "https://learn.unity.com/course/beginner-ai-pathfinding/tutorial/challenge-1-create-a-navmesh.md?language=en"
next_title: "Challenge 3: Create Dynamic & Static Obstacles"
next_url: "https://learn.unity.com/course/beginner-ai-pathfinding/tutorial/challenge-3-create-dynamic-static-obstacles?language=en"
next_markdown_url: "https://learn.unity.com/course/beginner-ai-pathfinding/tutorial/challenge-3-create-dynamic-static-obstacles.md?language=en"
difficulty: beginner
duration_minutes: 30
unity_version:
  - "2020.2"
  - "2020.1"
  - "2019.4"
  - "2019.3"
  - "2019.2"
  - "2019.1"
  - "2018.4"
  - "2018.3"
  - "2018.2"
  - "2018.1"
  - "2017.4"
  - "2017.3"
  - "2017.2"
  - "2017.1"
  - "5.x"
  - "4.x"
supported_unity_versions:
  - name: "2020.2"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2020.2"
  - name: "2020.1"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2020.1"
  - name: "2019.4"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2019.4"
  - name: "2019.3"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2019.3"
  - name: "2019.2"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2019.2"
  - name: "2019.1"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2019.1"
  - name: "2018.4"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2018.4"
  - name: "2018.3"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2018.3"
  - name: "2018.2"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2018.2"
  - name: "2018.1"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2018.1"
  - name: "2017.4"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2017.4"
  - name: "2017.3"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2017.3"
  - name: "2017.2"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2017.2"
  - name: "2017.1"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=2017.1"
  - name: "5.x"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=5.x"
  - name: "4.x"
    url: "https://learn.unity.com/tutorial/challenge-2-configure-a-navmesh-agent.md?language=en&version=4.x"
last_updated: "2026-08-04T14:21:54.000Z"
---

# Challenge 2: Create a NavMesh Agent

Configure a NavMesh Agent and fine-tune its movement settings to navigate your scene’s NavMesh effectively.

- _Configure a NavMesh Agent to move around the scene’s NavMeshes_
- _Customize the movement settings (slope, height, radius, step height)_

## 1. Configure a NavMesh Agent

1\. Select the Player GameObject in the Scene and in the Inspector add the NavMeshAgent Component and set the Base Offset value to 1 to compensate for the gap between the floor and the bottom of the Player’s mesh.

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/dd917574-3fd7-4977-a6de-a21e09be0fea_Unity_vXlHINpj1Y.png)

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/1d654f81-feb1-449c-8d2a-915fd64d7d24_unnamed.png)

2\. Create a new C# script called “PlayerController” and open it in your code editor.

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/564549cd-dd93-4f4d-bea0-936cc333794f_unnamed__1_.png)

3\. Add the following logic to the script so that mouse clicks update the Agent’s target position

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/6120169b-d2f2-4039-96f0-753db5481825_unnamed__2_.png)

4\. Back in the Unity Editor add your newly created PlayerController to the Player GameObject and configure the Serialized Values

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/05a7d6d6-192d-41b5-8a55-3026a0badac5_Unity_W2Ik02bvwK.png)

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/8cf6a720-6a61-48eb-b7eb-7902926da8cb_unnamed.gif)

5\. Click Play and click around the Scene to see the NavMeshAgent move

![](https://connect-mediagw.unity.com/h1/20200915/learn/images/77321893-90d9-4c39-8c9c-8e1916f5e382_n7s5TLTjOw.gif)
