unity-singleton-pattern
CommunityReliable global managers with strict lifecycle.
Software Engineering#unity#lifecycle#game-development#singleton#regulator#global-manager#cross-scene
AuthorMuharremTozan
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Unity projects often require global systems (like GameManager, UIManager) that persist across scenes and are easy to reason about. Without a controlled lifecycle, duplicates and inconsistent states arise, leading to hard-to-trace bugs.
Core Features & Use Cases
- Singleton<T>: standard single instance that destroys duplicates to keep the original.
- PersistentSingleton<T>: persists across scene loads.
- RegulatorSingleton<T>: keeps the NEWEST instance by destroying older ones to support hot-swapping.
- StaticInstance<T>: lightweight global reference without strict duplication enforcement.
- Use Case: create GameManager as a PersistentSingleton to maintain score and state across scenes, while UIManager can be a simple Singleton for global UI control.
Quick Start
Attach a manager to a Unity GameObject and access it via its Instance property.
Dependency Matrix
Required Modules
None requiredComponents
assets
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: unity-singleton-pattern Download link: https://github.com/MuharremTozan/Ohm-Yura/archive/main.zip#unity-singleton-pattern Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.