muharremtozan/unity-agent-skills

unity-singleton-pattern

Implementation of global manager access with strict lifecycle control. Supports Standard, Persistent, and Regulator variations.

First seen Apr 19, 2026

Installation

$ npx skills add muharremtozan/unity-agent-skills --skill unity-singleton-pattern

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from muharremtozan/unity-agent-skills · top by installs.

npx skills add muharremtozan/unity-agent-skills

Browse all from muharremtozan/unity-agent-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 13
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,715 B
  • docs SUMMARY.md 158 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 44 installs

SKILL.md

Unity Singleton Pattern

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)."

Core Features

  1. Singleton<T>: Standard management. Destroys new duplicates to keep the original.
  2. PersistentSingleton<T>: Extends Singleton with Don't Destroy On Load (DDOL) for cross-scene state.
  3. RegulatorSingleton<T>: Advanced inverse logic. Destroys OLD instances and keeps the NEWEST (useful for hot-swapping).
  4. StaticInstance<T>: Lightweight global access without duplication enforcement.

Core Files (Max 3)

  • 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.

Usage

1. Standard Manager

public class UIManager : Singleton<UIManager> { }
// Use via: UIManager.Instance.Show();

2. Persistent Manager

public class InventoryManager : PersistentSingleton<InventoryManager> { }
// Survives scene changes.

3. Regulator (System Swap)

public class MusicSystem : RegulatorSingleton<MusicSystem> { }
// Spawning a new one will automatically kill the old one.

Key Principle

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>.