unity-fsm
Unity Finite State Machine (FSM)
This skill provides a modular, object-oriented State Machine architecture for Unity, specifically refactored to match the implementation in Adam Myhre's 3D Platformer.
Core Features
- Object-Oriented: Each state is a dedicated class.
- Hybrid Support: Support for both "Heavy" (classes) and "Light" (
ActionState) states. - Strategy-Based Transitions: Uses Predicates and Detection Strategies.
- Timer System: Includes Adam Myhre's
CountdownTimerandStopwatchTimer. - Namespace Support: Uses
PlatformerandUtilitiesnamespaces.
Core Files (assets/code/)
IState.cs.txt,StateMachine.cs.txt,IPredicate.cs.txt: Base FSM logic.ActionState.cs.txt: New! Lambda-based state to reduce boilerplate.Timer.cs.txt: AI cooldown management.IDetectionStrategy.cs.txt,ConeDetectionStrategy.cs.txt: Sensing logic.PlayerDetector.cs.txt,Enemy.cs.txt,EnemyBaseState.cs.txt: AI templates.
Usage Guides
- GUIDE.md: General FSM setup and wiring.
- ENEMY-AI.md: Specific guide for implementing AI with Detection Strategies.
Implementation Pattern
- Define your states by inheriting from
BaseState. - Wire them in your
PlayerControllerorEnemyAIusingstateMachine.AddTransition. - Execute via
Update()andFixedUpdate()calls to the machine.
More from muharremtozan/unity-agent-skills
unity-so-prefab-manager
Manages the structured relationship between ScriptableObjects (Data) and Prefabs (Logic/Visuals) in Unity 6. Follows the 'SO-to-Mono' Bridge pattern to ensure instance independence (e.g., individual health for identical robots) while maintaining a clean, data-driven architecture. Use when: (1) Creating new unit/item types, (2) Wiring SO data to Prefab MonoBehaviours, (3) Resolving data-sharing bugs where changing one SO affects all instances.
16unity-code-reviewer
Professional Unity C# Code Reviewer. Detects anti-patterns, performance leaks, and enforces project-specific architecture.
10unity-assembly-management
Manage project boundaries using Assembly Definitions (.asmdef) for faster compile times and modular architecture. Based on the patterns by Adam Myhre. Enforces responsibility-based organization and handles Runtime/Editor/Tests splits.
9unity-event-bus
Advanced code-driven event bus with reflection-based bootstrapping. Provides zero-setup global messaging.
9unity-ui-data-binding
Implementation of MVVM-style Data Binding for Unity UI Toolkit using the [CreateProperty] attribute and BindableProperty wrappers.
9unity-observer-pattern
Reactive Property system for Unity. Decouples data from UI and logic using observable wrappers and UnityEvents.
8