unity-singleton-pattern
Implementation of global manager access with strict lifecycle control. Supports Standard, Persistent, and Regulator variations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implementation of global manager access with strict lifecycle control. Supports Standard, Persistent, and Regulator variations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Factory pattern for creating families of related objects. Supports both ScriptableObject composition and simple prefab instantiation.
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.
Step-by-step object construction using fluent interfaces. Simplifies complex GameObject setup.
Professional Unity C# Code Reviewer. Detects anti-patterns, performance leaks, and enforces project-specific architecture.
Encapsulate actions as objects for queuing, undo/redo, and async execution.
Implements "Composition over Inheritance" using ScriptableObject configs and C# Tuples. Replaces deep class hierarchies with modular, has-a relationships.
| name | unity-singleton-pattern |
| description | Implementation of global manager access with strict lifecycle control. Supports Standard, Persistent, and Regulator variations. |
A robust suite of Singleton variations for global systems. Adheres to the Ohm-Yura project rule: "Use Singletons ONLY for global systems (GameManager, UIManager, InputManager)."
SingletonBase.cs.txt: Generic base classes for classic and persistent variants.SingletonRegulator.cs.txt: Logic for the time-stamped regulator variant.SingletonExample.cs.txt: Concrete examples for Game and UI managers.public class UIManager : Singleton<UIManager> { }
// Use via: UIManager.Instance.Show();
public class InventoryManager : PersistentSingleton<InventoryManager> { }
// Survives scene changes.
public class MusicSystem : RegulatorSingleton<MusicSystem> { }
// Spawning a new one will automatically kill the old one.
Always use the most restrictive version. If it doesn't need to persist cross-scene, use Singleton<T>. If you just need a reference but don't mind duplicates, use StaticInstance<T>.