unity-npc-behavior
NPC Behavior -- Design Translation Patterns
Prerequisite skills:
unity-physics-queries(perception raycasts, NonAlloc query patterns),unity-state-machines(decision FSM/BT architecture),unity-game-architecture(event bus, Service Locator, component composition)
Claude's default NPC is a single MonoBehaviour with an Update() that raycasts, decides, and moves all in one method. This is untestable and unextensible -- changing perception logic requires touching decision logic, adding a new sense means rewriting the entire method, and squad coordination is impossible when each NPC is a self-contained island. These patterns decompose NPC behavior into pluggable layers that designers can configure without programmer intervention.
PATTERN: Perception System Architecture
DESIGN INTENT: NPCs sense the world through sight, hearing, and proximity. Different NPC types have different senses -- a guard has long-range sight but poor hearing; a dog has short sight but exceptional hearing. Senses are mix-and-match components that feed a unified target list.