# Initialize AI Navigation

Sets up and configures Unity AI Navigation, including NavMesh surfaces, agents...

- Repository: https://github.com/Unity-Technologies/skills (1197 stars)
- Category: AI and agents
- License: see repository
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Unity-Technologies/skills --skill initialize-ai-navigation -g -a claude-code -y`
Codex: `npx skills add Unity-Technologies/skills --skill initialize-ai-navigation -g -a codex -y`
Cursor: `npx skills add Unity-Technologies/skills --skill initialize-ai-navigation -g -a cursor -y`
Gemini CLI: `npx skills add Unity-Technologies/skills --skill initialize-ai-navigation -g -a gemini-cli -y`

## Description

Sets up and configures Unity AI Navigation, including NavMesh surfaces, agents, obstacles, and links. Use when the user asks about navigation meshes, pathfinding, patrol routes, or obstacle avoidance.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

Determine what the user needs and guide them through navigation setup. See [navigation-system.md](references/navigation-system.md) for expanded component details, API notes, code recipes, and troubleshooting.

### Passing C# to `script eval`

`script eval` compiles a **statement block, not a file**. Two consequences, both of which cause a
compile error rather than a warning:

- **No `using` directives.** The compiler reads `using UnityEngine;` as a resource-disposal
  statement and rejects it (`CS0210`).
- **Types must be fully qualified.** A bare `AssetDatabase` or `Volume` does not resolve
  (`CS0246` / `CS0103`), and a bare `Object` is ambiguous with `object` (`CS0104`).

Where a snippet below is written as a file, with usings, for readability, or because it is
meant to be saved into the project, qualify the types before passing it to `script eval`.

## Routing Logic

| User Says | Interpretation |
|-----------|---------------|
| "add navigation" / "set up nav" | Full setup: NavMeshSurface + bake + NavMeshAgent |
| "make this character navigate" | Add NavMeshAgent, ensure NavMesh exists |
| "add pathfinding" | NavMeshAgent + movement script |
| "agent won't move" / "path not found" | Troubleshoot, see Troubleshooting Decision Tree in reference |
| "avoid obstacles" | NavMeshObstacle with carving or avoidance |
| "connect two areas" / "jump across" | NavMeshLink between areas |
| "patrol between points" | NavMeshAgent + patrol script |
| "click to move" | NavMeshAgent + raycast click-to-move script |
| "animate the character while navigating" | Couple Animator with NavMeshAgent |
| "different agent sizes" | Configure agent types in Navigation window |
| "areas and costs" / "restrict areas" | NavMesh area types, modifiers, and agent area masks |

## Workflow

The rest: https://github.com/Unity-Technologies/skills/blob/HEAD/skills/initialize-ai-navigation/SKILL.md
