← Zurück zu PlayCanvas Engine · Projektplanungspaket

Skill · Version 1.0.0

Unity-NPC-Verhalten

Entwirft nachvollziehbares Unity-NPC-Verhalten mit Wissensgrenzen, Prioritäten und Unterbrechungen. Nutzt das kleinste geeignete Entscheidungsmodell ohne allwissende Verfolgung unbeobachteter Spielerpositionen.

unity-npc-behavior

Agenten mit diesem Skill

Entdecke, wie der Skill hilft

Wann ist der Skill hilfreich?

Nutze ihn für Patrouille, Kampf oder Schwierigkeit ohne unnötig großes KI-Framework.

Wobei hilft er dir?

  • Wählt das kleinste passende Entscheidungsmodell für die Mechanik.
  • Definiert Bedingungen, Prioritäten, Abbruch, Zielgültigkeit und Abklingzeiten.
  • Trennt wahrgenommenes Wissen von Ausführung ohne allwissende Verfolgung.

Das könntest du fragen

Baue eine Unity-Wache, die patrouilliert, Geräusche untersucht und nach Sichtverlust sucht. Definiere die Erinnerungsdauer an den letzten Ort und wann Angriff die Suche unterbricht. Teste Verstecken hinter Deckung und verschwundene Ziele: Die Wache braucht eine gültige Folgeaktion ohne Kenntnis unsichtbarer Positionen.

Ausführliche Dokumentation

Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.

Details…Weniger anzeigen

NPC Decisions and Behavior

Choose the smallest decision model

Read project instructions, Unity/package versions, existing NPC code, movement/animation authority and networking rules. Define player-facing scenarios and what each NPC may know. Reuse the current architecture unless the task calls for replacing it. A small FSM is often sufficient; use behavior trees, utility scoring or planning when the actual decision complexity warrants them.

Decision contracts

  • Separate perception and memory from decision making, action execution, steering and locomotion. Actions consume known facts and issue motor commands instead of directly competing with the movement controller.
  • Specify states/actions, entry and exit behavior, guards, priorities, interruption, cooldowns and failure results. A task that never completes or cancels can stall an entire behavior tree.
  • For utility decisions, document considerations, normalization, invalid choices, tie handling and fallback. Add hysteresis/commitment where needed so small score changes do not cause rapid oscillation.
  • Give targets explicit validity and memory expiry. Handle death, despawn, pooling, scene changes and stale references. Cancellation must release reservations, subscriptions and motor commands.
  • Define fairness: reaction delay, line of sight, hearing, last-known position, attack telegraphs and permitted shared knowledge. Do not silently grant omniscient player tracking.
  • Bound decision frequency and expensive work. Check the intended crowd size and avoid synchronized spikes; optimize from traces, not assumptions.
  • Unity Behavior and other frameworks are optional dependencies. Check the installed version before choosing graph APIs; do not claim a graph exists or hand-edit its serialized representation without verified tooling.

Verify and explain

Expose current state/action, transition reason, known target, memory age and relevant scores. Exercise idle/patrol, detection, pursuit, attack, target loss, interrupted action and recovery. Use controlled randomness for reproduction; do not claim fairness or believability from compilation alone.

References: version-matched Unity Behavior, Craig Reynolds's action-selection/steering/locomotion model and Dave Mark's utility architecture overview. These are design references, not required libraries. Inspect relevant official Unity agent skills before proposing additional tools. LLM inference or ML training is a separate explicitly authorized feature, not a prerequisite for NPC AI.

Enthaltene Dateien 1

  • SKILL.md