unity-memento-pattern
Unity Memento Pattern
This skill provides a structured way to handle state snapshots in Unity. Inspired by Adam Myhre's implementation, it strictly separates state data (Memento), the state producer (Originator), and the state manager (Caretaker).
Core Features
- Immutable Snapshots: Ensures saved data cannot be corrupted by subsequent changes to the original object.
- Loadout Management: Built-in support for multiple save slots (Caretaker logic).
- Encapsulation: State structure is hidden from the resting system, exposing only what is necessary.
Core Files (Max 3)
IMemento.cs.txt: Base interfaces and generic Memento wrapper.LoadoutManager.cs.txt: Caretaker implementation for managing list-based snapshots.HotbarMementoExample.cs.txt: Practical application for UI/Item state persistence.
Usage
Refer to HotbarMementoExample.cs.txt to see how to save a list of ScriptableObjects using a copy-constructor.
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