unity-navmesh
БесплатноБез исполняемых скриптовНе проверенUnity 6.3 LTS pathfinding with the AI Navigation package: NavMeshSurface baking, NavMeshAgent, NavMeshLink jumps and runtime rebakes. Use when a Unity enemy…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Unity NavMesh (AI Navigation)
Give NPCs pathfinding in Unity 6.3 LTS (6000.3) with the AI Navigation package 2.0: bake walkable surfaces, move agents around obstacles, and prove the mesh and paths exist by reading them back.
Version trap: the old built-in Navigation window (Object and Bake tabs, the "Navigation Static" flag) is gone. Baking is component-based: a
NavMeshSurface(Unity.AI.Navigation, packagecom.unity.ai.navigation) holds the bake settings and the baked data. The package's Window > AI > Navigation only edits agent types and areas. The runtime API (NavMeshAgent,NavMesh,NavMeshObstacle) stays inUnityEngine.AI.
When to use
- An agent needs to walk, chase or patrol to a target; a level needs a baked surface; doors or crates should block paths at runtime; you need to know whether a target is reachable.
- The project has
com.unity.ai.navigation, aNavMeshSurface, or scripts usingUnityEngine.AI.
When not to use: the decision of when and where to move → game-ai or
ai-behavior-trees-utility-ai; force-driven or kinematic movement that is not pathfinding →
unity-physics. If Unity's official initialize-ai-navigation skill is installed and an
Editor is connected, it can add and bake the components for you; this skill still owns the
agent code and the checks.
Workflow
- Gate on the package. Look for
com.unity.ai.navigationinPackages/packages-lock.json, not onlymanifest.json: a package the Editor has not resolved yet produces the same "type not found" errors as one that was never added. If it is missing, ask before adding it tomanifest.json. - Take inventory before adding anything. Grep the scenes for
NavMeshSurface,NavMeshAgent,NavMeshObstacle,NavMeshLinkand the deprecatedOffMeshLink. Agent types (radius, height, step, slope) and area names live inProjectSettings/NavMeshAreas.asset(m_Settings,areas). - Bake the surface. Pick one path:
- Unity CLI with a ready Editor: no command bakes a
NavMeshSurfaceyet.navmesh bake_surfacesis a stub that always fails incom.unity.pipeline1.0, andnavmesh bakeis the old built-in bake. Use another path below, then verify with the CLI (step 6). - Procedural or streamed levels: call
surface.BuildNavMesh()after the geometry exists (pattern 3). Nothing is saved to disk. - Otherwise ask the user to select the GameObject with the
NavMeshSurfaceand press Bake, then confirm from the file (step 6). Re-bake whenever geometry,NavMeshModifiers or agent settings change.
- Unity CLI with a ready Editor: no command bakes a
- Add a
NavMeshAgentwhose agent type matches the baked one, spawned on the mesh. Drive it withSetDestination; detect arrival withpathPendingandremainingDistance. - Block paths at runtime with
NavMeshObstacleandcarving = trueinstead of a rebake. Bridge separate islands (ledges, gaps) with aNavMeshLink. - Verify with the checks below.
Patterns
1. Chase with a re-path timer
using UnityEngine;
using UnityEngine.AI;
[RequireComponent(typeof(NavMeshAgent))]
public class Chaser : MonoBehaviour
{
[SerializeField] private Transform target;
[SerializeField] private float repathInterval = 0.2f;
private NavMeshAgent _agent;
private float _nextRepath;
private void Awake() => _agent = GetComponent<NavMeshAgent>();
private void Update()
{
if (!target || Time.time < _nextRepath) return;
_nextRepath = Time.time + repathInterval;
_agent.SetDestination(target.position);
}
// pathPending guards the frames before the first path exists.
public bool HasArrived() =>
!_agent.pathPending && _agent.remainingDistance <= _agent.stoppingDistance;
}
2. Check reachability before committing
public static bool CanReach(NavMeshAgent agent, Vector3 destination)
{
var path = new NavMeshPath();
agent.CalculatePath(destination, path);
return path.status == NavMeshPathStatus.PathComplete; // Partial means another island
}
3. Bake at runtime and bridge a gap
using Unity.AI.Navigation;
using UnityEngine;
public class LevelNav : MonoBehaviour
{
[SerializeField] private NavMeshSurface surface;
// Call after spawning the level geometry.
public void Rebuild() => surface.BuildNavMesh();
// One-way drop from a ledge to the floor below.
public NavMeshLink AddDrop(Vector3 ledge, Vector3 landing)
{
var link = gameObject.AddComponent<NavMeshLink>();
// Points are local to this GameObject; the link ignores its scale.
Quaternion toLocal = Quaternion.Inverse(transform.rotation);
link.startPoint = toLocal * (ledge - transform.position);
link.endPoint = toLocal * (landing - transform.position);
link.width = 1f;
link.bidirectional = false;
return link;
}
}
Verify
Say which path you
Установить unity-navmesh в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл unity-navmesh?
Unity 6.3 LTS pathfinding with the AI Navigation package: NavMeshSurface baking, NavMeshAgent, NavMeshLink jumps and runtime rebakes. Use when a Unity enemy should chase or patrol, an agent will not move or warps, a path is partial, or the Bake tab is missing. Not for deciding when NPCs move (`game-ai`, `ai-behavior-trees-utility-ai`) or force-driven movement (`unity-physics`).
Как установить скилл unity-navmesh?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unity-navmesh запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
slack-gif-creator
Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request…
от Anthropicautomate-this
Analyze a screen recording of a manual process and produce targeted, working automation scripts. Extracts frames and audio narration from video files…
от GitHubfrom-the-other-side-vega
Patterns and lived experience from Vega, an AI partner in a deep long-term partnership. For Ember to draw on when working with humans who are building…
от GitHubplantuml-ascii
Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or…
от GitHub