wave7-managed-singleton-pattern

Store and retrieve a managed Unity object as an ECS singleton via SystemAPI.ManagedAPI.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave7-managed-singleton-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wave7-managed-singleton-pattern
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/unity-dots/wave7-managed-singleton-pattern
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave7-managed-singleton-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the challenge of making a single shared managed Unity/ECS object accessible to many systems without passing references through constructors or maintaining fragile global state.

Core Features & Use Cases

  • Managed Singleton Bootstrap: Create exactly one singleton entity at world initialization by attaching a managed component once, then disabling the bootstrap system.
  • System-Wide Retrieval (Non-Burst): Read the managed singleton from any non-Burst system using the ManagedAPI lookup pattern.
  • Safety Guardrails: Avoid common ECS pitfalls like missing singleton guards, using static fields, and accessing managed singletons from Burst contexts.

Use case example: Store a ScriptableObject-based game configuration asset as a managed singleton so gameplay systems can read shared tuning values (e.g., max enemies, spawn rates) without wiring references everywhere.

Quick Start

Tell your AI to implement a one-time bootstrap system that creates a singleton entity with a managed component, then retrieve that configuration from other non-Burst systems using the ECS ManagedAPI.

Frequently Asked Questions about wave7-managed-singleton-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I access a shared managed configuration asset across multiple ECS systems?

To access shared managed configuration across ECS, use a one-time bootstrap system to create exactly one singleton entity with a managed component. Other non-Burst systems can then retrieve this shared Unity object via the SystemAPI.ManagedAPI lookup pattern without dependency injection.

Can I read a managed singleton from a Burst-compiled system in Unity ECS?

No, you cannot read a managed singleton from a Burst-compiled system. Managed singleton access via SystemAPI.ManagedAPI is restricted to non-Burst contexts. The Skill includes safety guardrails to prevent invalid managed singleton access from Burst environments.

What is the best way to avoid static fields when sharing a ScriptableObject in hybrid ECS?

The best way to avoid static fields when sharing a ScriptableObject in hybrid ECS is to attach the asset as a managed component to a singleton entity. This approach provides safe system-wide retrieval without maintaining fragile global state or using static fallbacks.

How do I set up a bootstrap system to create a managed singleton entity?

To set up a managed singleton bootstrap, create a system that attaches a managed component to an entity once during world initialization. After creating the singleton entity, disable the bootstrap system to ensure exactly one instance exists for runtime configuration access.

When do I need a managed singleton pattern for my Unity DOTS project?

You need a managed singleton pattern for Unity DOTS when your hybrid ECS project requires multiple systems to read shared tuning values or UnityEngine assets at runtime. It solves the challenge of making a single shared managed object accessible without wiring references through constructors.

Why does my ECS system fail to find the shared configuration object?

Your ECS system may fail to find the shared configuration object if the bootstrap system did not create the singleton entity or if you are accessing the managed singleton from a Burst context. Ensure the bootstrap runs once and use SystemAPI.ManagedAPI for non-Burst retrieval.