unity-strategy-pattern
Unity Strategy Pattern
This skill implements the Strategy Behavioral Pattern to replace conditional logic (switches/ifs) with interchangeable algorithm objects.
Core Features
- Encapsulated Logic: Each behavior (Fireball, Shield, Orbital) lives in its own
ScriptableObjector class. - Hot-Swapping: Change an entity's behavior at runtime by swapping the strategy asset.
- Open/Closed Compliance: Add new spells/behaviors without modifying the
PlayerController.
Core Files (assets/code/)
SpellStrategy.cs.txt: Base abstract ScriptableObject (The Interface).ShieldSpellStrategy.cs.txt: Simple instantiation strategy.OrbitalSpellStrategy.cs.txt: Complex math/logic strategy (Pro Path).
Usage Guide
See GUIDE.md to learn how to create flexible Ability/Spell systems using Strategies.
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-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.
11unity-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.
9