unity-navmesh
यह क्या करती है
यह स्किल दिखाती है कि Unity में navigation mesh से किरदारों को रुकावटों के आसपास कैसे चलाएँ। यह उन डेवलपर्स के लिए है जो दुश्मनों को खिलाड़ी का पीछा करवाना या पहरेदारों को गश्त करवाना चाहते हैं।
कब इस्तेमाल करें
- ✓जब आप चाहें कि Unity में दुश्मन दीवारों के आसपास घूमकर खिलाड़ी का पीछा करे।
- ✓जब आपको Unity सीन में किरदारों के लिए चलने योग्य सतह बेक करनी हो।
- ✓जब गेम के दौरान बक्से या दरवाज़े जैसी रुकावटें रास्ते को रोकें या बदलें।
Skill का लिंक
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/unity/unity-navmesh/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे Unity लेवल का पहरेदार दीवारों से बचते हुए खिलाड़ी की जगह तक चले, ऐसा कीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह लेवल में navigation surface कंपोनेंट जोड़ना, उसे बेक करना, और एजेंट को गंतव्य पर भेजना समझाती है, साथ में चलने वाली चीज़ों के लिए obstacle कंपोनेंट का इस्तेमाल भी।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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 runtimeNavMeshAgent/NavMeshAPI stays in built-inUnityEngine.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
NavMeshSurfacecomponent, or scripts usingUnityEngine.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
- Install the AI Navigation package (Package Manager →
com.unity.ai.navigation). - 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,
NavMeshModifiers, or agent settings change. Agent types (radius, height, step, slope) are defined in Window → AI → Navigation → Agents. - Add a
NavMeshAgentto each moving NPC; its radius/height/speed must match the baked agent type, and it must spawn on the baked mesh. - Drive it from script with
SetDestination(targetPos); the agent steers and avoids other agents automatically. Detect arrival withremainingDistance/pathPending. - Handle dynamic blockers with
NavMeshObstacle(carving) so closed doors/crates block paths without a full re-bake. - 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.statusfor unreachable targets.
Patterns
1. Chase/seek with a NavMeshAgent
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
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)
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
// 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)
// 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 Naviga
अक्सर पूछे जाने वाले सवाल
सतह बेक क्यों करनी पड़ती है?
बेकिंग Unity को बताती है कि कौन से इलाके चलने योग्य हैं, ताकि एजेंट जान सकें कि वे कहाँ जा सकते हैं।
क्या यह तय करती है कि दुश्मन कब पीछा करे?
नहीं। फ़ैसले का लॉजिक एक अलग गेम AI स्किल में है, और यह स्किल गति संभालती है।
क्या यह पुरानी Navigation विंडो के साथ काम करती है?
स्किल बताती है कि पुरानी विंडो हट चुकी है, और अब बेकिंग AI Navigation पैकेज के एक कंपोनेंट से होती है।
जानकारी
लेखक का मूल विवरण
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.
लोकप्रियता
- GitHub स्टार
- 6.6k
- रैंकिंग में स्थान
- #13848
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 28/10/2026
कमेंट
- …
इस repository की और skills
router
6.6kयह आपके एजेंट को इंजन और काम के प्रकार को पहचानकर किसी अनुरोध के लिए सही गेम डेवलपमेंट स्किल चुनने में मदद करती है।
ai-behavior-trees-utility-ai
6.6kयह आपके एजेंट को दुश्मनों और किरदारों के लिए बिहेवियर ट्री और यूटिलिटी AI सिस्टम बनाने में मदद करती है, जो प्राथमिकता और स्कोर से कार्रवाई चुनें।
audio-design
6.6kआपके एजेंट को गेम ऑडियो मिक्सिंग सिखाती है: बस, डेसिबल में वॉल्यूम, डायलॉग में म्यूज़िक धीमा करना और साउंड इफ़ेक्ट की विविधता।
camera-systems
6.6kयह आपके एजेंट को ऐसे गेम कैमरा बनाने में मदद करती है जो सहजता से पीछा करें, लेवल के भीतर रहें, और 3D में घूम या देख सकें।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।