unity-fsm
Specialized skill for implementing a robust, extensible Finite State Machine in Unity using the State and Strategy patterns. Based on the pattern by Adam Myhre (3D Platformer). Use when creating complex AI, player controllers, or any system requiring structured state management.
How do I install this agent skill?
npx skills add https://github.com/muharremtozan/unity-agent-skills --skill unity-fsmIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides a collection of C# templates for implementing a Finite State Machine in the Unity game engine. It consists of standard object-oriented code and documentation with no security risks detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
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.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/muharremtozan/unity-agent-skills/unity-fsm">View unity-fsm on skillZs</a>