К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

unity-navmesh скилл — навигация в Unity для Claude Code

Скилл для ИИ-кодинга: печёт NavMesh на уровне Unity и водит NPC по маршруту через NavMeshAgent. Пригодится, когда враг должен догонять игрока, а не стоять на месте.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-navmesh -a claude-code
Открыть на GitHub

Что делает unity-navmesh

Скилл даёт агенту рабочий порядок действий для Unity 6.3 LTS: запечь NavMesh компонентом NavMeshSurface из пакета AI Navigation 2.0, потом водить персонажей через NavMeshAgent.SetDestination. Внутри есть шаблоны скриптов на C# и список грабель, на которых легко потерять вечер.

Старые туториалы тут вредят. Окно Navigation с вкладкой Bake и флагом Navigation Static из Unity 2022+ убрали, поэтому печь навмеш теперь надо с компонента и перепекать после каждой правки геометрии. Агент, которого не поставили на запечённую поверхность, никуда не пойдёт, а телепортируется в начало координат — это повод проверить сцену до отладки логики.

Динамические препятствия скилл закрывает через NavMeshObstacle с carving, разрывы между островами навмеша через NavMeshLink: встроенный OffMeshLink в AI Navigation 2.0 устарел и больше не добавляется из меню. Проверка достижимости идёт через NavMeshPath.status, для процедурных уровней есть перестройка навмеша в рантайме, для телепорта — agent.Warp().

Какие задачи решает

  • запечь NavMesh на геометрии уровня и перепечь его после правок
  • заставить врага преследовать игрока по проходимому маршруту
  • закрыть дверь или ящик на пути без полной перепечки
  • соединить два несоприкасающихся острова навмеша перепрыжкой
  • отловить недостижимую цель до запуска движения

Примеры запросов агенту

  • Запеки NavMesh на геометрии уровня через `NavMeshSurface` и поставь NPC на поверхность.
  • Напиши скрипт, где враг идёт за игроком через `NavMeshAgent.SetDestination` и тормозит на `stoppingDistance`.
  • Проверь достижимость точки через `CalculatePath`, а старый `OffMeshLink` замени на `NavMeshLink`.

Как установить unity-navmesh

1Через Skills CLI (Vercel)

npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-navmesh -a claude-code

2Вручную: положить файлы

~/.claude/skills/unity-navmesh/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/unity-navmesh/

Из того же набора40

Весь набор →
game-feel gamedev-skills Скилл учит агента добавлять отклик к игровым действиям: тряску камеры, стоп-кадр, твины с easing, сквош и отброс. Для случаев, когда механика работает, но ощущается ватной. Claude Code CX Codex Cursor +1 9 400установок game-ui-ux gamedev-skills Архитектурный скилл для создания адаптивных игровых интерфейсов, стека экранов и навигации с геймпада без покадрового опроса состояния. Claude Code CX Codex Cursor +1 9 200установок level-design gamedev-skills Помогает спроектировать игровой уровень от блокута до плейтеста: маршруты, темп, препятствия и столкновения. Нужен при работе с whitebox, критическим путём и геймплейными комнатами. Claude Code CX Codex Cursor +1 7 500установок camera-systems gamedev-skills Рецепты для игровых камер в 2D и 3D: плавное следование, мёртвые зоны, опережение движения и обработка столкновений для Godot и Unity. Claude Code CX Codex Cursor +1 7 100установок audio-design gamedev-skills Скилл учит раскладывать игровой звук по шинам, глушить музыку под голос и собирать адаптивный саундтрек слоями. Примеры кода — на GDScript под Godot 4.7, с пометками для Unity. Claude Code CX Codex Cursor +1 7 100установок performance-optimization gamedev-skills Скилл учит искать узкое место в игре по профайлеру движка, а не по догадке, и даёт набор правок: пулы объектов, батчинг, отказ от лишних аллокаций. Claude Code CX Codex Cursor +1 7 100установок game-ai gamedev-skills Помогает проектировать логику врагов и NPC: конечные автоматы, деревья поведения, алгоритмы руления и поиск пути A*. Пригодится при сборке поведения ботов для любого движка. Claude Code CX Codex Cursor +1 7 100установок input-systems gamedev-skills Архитектура игровых управлений: отображение клавиш на действия, перекоординирование с проверкой конфликтов, поддержка клавиатуры, геймпада и сенсора, мёртвые зоны, буферизация и coyote time. Claude Code CX Codex Cursor +1 6 800установок

Похожие

threejs-game-director majidmanzarpour Скилл-режиссёр для браузерных игр на Three.js: ведёт от играбельного цикла до графики, UI и проверки в браузере, раздавая фазы соседним скиллам. Claude Code CX Codex Cursor +1 3 000установок orbit-card heygen-com Скилл для встраивания готового 10-секундного 3D-блока HyperFrames: карточка фичи облетает сферу из точек по траектории камеры из Blender. Claude Code CX Codex Cursor +1 9 800установок sdf earthtojake Скилл создаёт и проверяет SDFormat-файлы для моделей и миров, а затем помогает подготовить их к передаче в симулятор. Claude Code CX Codex Cursor +1 10 500установок urdf earthtojake Скилл помогает создавать, проверять и отлаживать описания роботов в формате URDF. Пригодится для работы со звеньями, сочленениями и геометрией. Claude Code CX Codex Cursor +1 10 400установок hatch-pet официальный openai Создаёт и упаковывает анимированных питомцев и спрайт-листы для Codex. Пригодится, когда нужен персонаж по описанию, изображению или фирменным ориентирам. Claude Code CX Codex Cursor +1 3 300установок gcode earthtojake Нарезает модели STL, 3MF и OBJ в G-code через OrcaSlicer. Подходит, когда нужно подготовить файл для печати без подключения к принтеру. Claude Code CX Codex Cursor +1 9 500установок dxf earthtojake Скилл собирает и проверяет 2D DXF-чертежи из Python-скриптов на build123d: контуры, прокладки, панели, развёртки под лазер. Claude Code CX Codex Cursor +1 9 100установок

Вопросы о unity-navmesh

Как установить unity-navmesh в Claude Code?

Выполни npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-navmesh -a claude-code. Файл скилла появится по пути ~/.claude/skills/unity-navmesh/SKILL.md.

Что делает unity-navmesh?

Описывает агенту, как добавить в проект навигацию: установить пакет AI Navigation, запечь поверхность через NavMeshSurface, завести NavMeshAgent и развести препятствия. Он же перечисляет типичные ошибки с настройкой сцены.

Что нужно для работы скилла?

Проект на Unity 6.3 LTS с пакетом com.unity.ai.navigation версии 2.0: без него компонента NavMeshSurface в меню не будет. Логика поведения NPC сюда не входит, это отдельный скилл про игровой ИИ.

Исходный текст

SKILL.md · Apache-2.0
---
name: unity-navmesh
description: >
  Add AI navigation in Unity 6.3 LTS: bake a NavMesh with the AI Navigation package (NavMeshSurface),
  move agents with NavMeshAgent.SetDestination, and handle dynamic obstacles. Use when setting
  up pathfinding, making an enemy chase the player, baking navigation, or when the user
  mentions NavMesh, NavMeshAgent, NavMeshSurface, NavMeshObstacle, or Unity pathfinding.
---

# Unity NavMesh (AI Navigation)

Give NPCs pathfinding in Unity 6.3 LTS: bake walkable surfaces and move agents around obstacles.
Targets **Unity 6.3 LTS (6000.3)** with the **AI Navigation package 2.0** (2.0.16 at last check).

> **Version trap (Unity 2022+/6):** the old built-in **Navigation window** (Object/Bake tabs,
> "Navigation Static" flag) is gone. The package's **Window → AI → Navigation** only holds the
> Agents and Areas tabs. Baking is now **component-based** via the **AI Navigation package**
> (`com.unity.ai.navigation`): add a **NavMeshSurface** to your level geometry and click
> **Bake**. The *runtime* `NavMeshAgent`/`NavMesh` API stays in built-in `UnityEngine.AI`.

## When to use

- Use when an agent needs to walk/chase/patrol to a target, when baking a navigable surface,
  adding dynamic blockers (`NavMeshObstacle`), or checking whether a destination is reachable.
- Use when the project has the AI Navigation package, a `NavMeshSurface` component, or scripts
  using `UnityEngine.AI.NavMeshAgent`.

**When *not* to use:** the *decision* logic of when/where to move (FSMs, behaviour trees,
steering) → `game-ai` (this skill is the Unity movement/pathing mechanism). Force-driven or
kinematic movement that isn't pathfinding → `unity-physics`.

## Core workflow

1. **Install the AI Navigation package** (Package Manager → `com.unity.ai.navigation`).
2. **Bake a surface:** select the static level geometry, **Add Component → Navigation → NavMesh
   Surface**, set the agent type/area settings, and click **Bake**. Re-bake whenever geometry,
   `NavMeshModifier`s, or agent settings change. Agent types (radius, height, step, slope)
   are defined in **Window → AI → Navigation → Agents**.
3. **Add a `NavMeshAgent`** to each moving NPC; its radius/height/speed must match the baked
   agent type, and it must spawn *on* the baked mesh.
4. **Drive it from script** with `SetDestination(targetPos)`; the agent steers and avoids other
   agents automatically. Detect arrival with `remainingDistance`/`pathPending`.
5. **Handle dynamic blockers** with `NavMeshObstacle` (carving) so closed doors/crates block
   paths without a full re-bake.
6. **Verify** with the AI Navigation overlay (the baked mesh is drawn in the Scene view) and by
   watching agents path around obstacles to the goal; check `NavMeshPath.status` for
   unreachable targets.

## Patterns

### 1. Chase/seek with a NavMeshAgent

```csharp
using UnityEngine;
using UnityEngine.AI;

[RequireComponent(typeof(NavMeshAgent))]
public class Chaser : MonoBehaviour
{
    [SerializeField] private Transform target;
    private NavMeshAgent _agent;

    private void Awake() => _agent = GetComponent<NavMeshAgent>();

    private void Update()
    {
        if (target) _agent.SetDestination(target.position);   // re-path toward the target
    }

    // Arrived? pathPending guards the first frame before a path exists.
    private bool HasArrived() =>
        !_agent.pathPending && _agent.remainingDistance <= _agent.stoppingDistance;
}
```

### 2. Check reachability before committing

```csharp
using UnityEngine.AI;

public bool CanReach(NavMeshAgent agent, Vector3 destination)
{
    var path = new NavMeshPath();
    agent.CalculatePath(destination, path);
    return path.status == NavMeshPathStatus.PathComplete;   // vs Partial / Invalid
}
```

### 3. Bake at runtime (for procedurally built or streamed levels)

```csharp
using Unity.AI.Navigation;   // the package namespace (NavMeshSurface)

[SerializeField] private NavMeshSurface surface;

// After spawning level geometry, build the navmesh in code.
public void RebuildNav() => surface.BuildNavMesh();
```

### 4. Dynamic obstacle that carves the mesh

```csharp
// Add a NavMeshObstacle (Carve = true) to a door/crate. While present it cuts a hole in the
// navmesh so agents route around it; remove/disable it to reopen the path — no re-bake needed.
```

### 5. Connect separate mesh pieces with a NavMeshLink (jumps, doors, gaps)

```csharp
// Two baked surfaces that don't touch (a ledge and the floor below, two platforms across a
// gap) are separate islands — an agent can't path between them. Add Component > Navigation >
// NavMesh Link to bridge them: assign Start/End Transforms, set Width (0 = point-to-point),
// and toggle Bidirectional for one-way vs two-way. NavMeshLink lives in Unity.AI.Navigation.
// It replaces the deprecated built-in OffMeshLink (see pitfalls).
```

## Pitfalls

- **Looking for the Bake tab or the Navigation Static flag** — the old Navigation window was
  removed in AI Navigation 2.0. Bake from a `NavMeshSurface` component; the package's
  Window → AI → Navigation only edits agent types and areas.
- **Agent doesn't move / warps to origin** — it isn't on the baked mesh, or no surface was
  baked. Bake the surface and spawn the agent on it (`NavMesh.SamplePosition` to snap).
- **Agent ignores new geometry** — the navmesh is baked; runtime-spawned obstacles need a
  `NavMeshObstacle` (carving) or a `surface.BuildNavMesh()` re-bake.
- **`SetDestination` every frame is wasteful** — for a slow-moving target, re-path on a timer
  (e.g. every 0.2s) instead of each frame.
- **An NPC with a Rigidbody jitters or drifts off its path** — a `NavMeshAgent` and a
  non-kinematic `Rigidbody` both move the transform. Tick **Is Kinematic** while the agent
  is in control.
- **An agent with a `NavMeshObstacle` on the same GameObject spins or slides** — it tries to
  avoid itself (worse with carving). Keep only one of them enabled at a time, e.g. switch the
  agent off and the obstacle on when the NPC stops for good.
- **Teleporting an agent** — use `agent.Warp(position)` (returns false if it fails), not a
  plain Transform write.
- **Agent radius/height mismatch** — if the `NavMeshAgent`'s size differs from the baked agent
  type, it gets stuck in gaps or floats; keep them consistent.
- **Agents jitter against each other** — tune `avoidancePriority` and quality, or use an
  obstacle for truly static blockers rather than relying on agent avoidance.
- **Reaching for `OffMeshLink`** — the built-in `OffMeshLink` component is **deprecated** in
  AI Navigation 2.0 and can no longer be added from the Add Component menu. Use a
  **`NavMeshLink`** (from the package, `Unity.AI.Navigation`) instead — it adds Transform-based
  endpoints and a runtime `activated` property. Migrate any existing `OffMeshLink`s.
- **`CalculatePath` returns `PathPartial`** — the destination sits on a *different* baked
  island than the agent (a gap the mesh doesn't cross). Bridge the two with a `NavMeshLink`
  (pattern 5) or extend the geometry so one surface covers both; a partial path only reaches
  the near edge.

## References

- Primary docs: AI Navigation package manual
  (`https://docs.unity3d.com/Packages/[email protected]/manual/index.html`),
  the `NavMeshLink` page
  (`https://docs.unity3d.com/Packages/[email protected]/manual/NavMeshLink.html`)
  and its "What's new" note on the `OffMeshLink` deprecation
  (`https://docs.unity3d.com/Packages/[email protected]/manual/whats-new.html`), the
  "Navigation window" and "Use NavMesh Agent with other components" pages
  (`NavigationWindow.html`, `MixingComponents.html` in the same manual), plus
  `ScriptReference/AI.NavMeshAgent`, `ScriptReference/AI.NavMesh`.

## Related skills

- `game-ai` — engine-agnostic decision-making (FSM, behaviour trees, steering) that *uses* this.
- `unity-csharp-scripting` — the MonoBehaviour structure around the agent.
- `tower-defense` / `fps-shooter` — genres that compose pathfinding with gameplay.

© gamedev-skills · Apache-2.0 · gamedev-skills/awesome-gamedev-agent-skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой