data-manager

Manages key-value data for objects, scenes, and global registry in Phaser 4.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill data-manager-raphe-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-manager
Source: https://github.com/Raphe-dev/phaser-cozy-mmo/tree/main/skills/data-manager
Command: npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill data-manager-raphe-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The DataManager system centralizes and orchestrates key-value data for game objects, scenes, and the global registry, enabling reactive updates and decoupled logic without tight coupling.

Core Features & Use Cases

  • Per-GameObject data: automatically creates a DataManager on first use and supports setData/getData/incData/toggleData to drive gameplay state.
  • Scene-level data: use this.data to store scene-specific values and react to changedata events through the scene's event bus.
  • Global registry: share data across all scenes via game.registry with persistent lifecycle and per-key events.
  • Use cases: keep player state in sync, drive UI with scores, and persist state across scenes while remaining loosely coupled.

Quick Start

Initialize a sprite and assign data with setData, then listen for changedata events to react when values change.

Frequently Asked Questions about data-manager

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

FAQPage Schema
How do I share reactive game data across multiple Phaser scenes?

To share reactive game data across multiple Phaser scenes, use the global registry provided by the game object. It enables cross-scene state management with per-key event emission, allowing decoupled updates across your game.

How does Phaser handle event-driven updates for game object data?

Phaser handles event-driven updates by emitting changedata events on the owner whenever values are modified via the DataManager. You can listen to these events on the object, scene, or global registry to trigger reactive logic.

Can I store scene-specific state data without coupling logic in Phaser 4?

Yes, you can store scene-specific state data without tight coupling by using the scene-level data manager (this.data). It supports key-value storage and reacts to changedata events through the scene's event bus for localized state management.

What data operations are supported for managing game state in Phaser?

Supported operations for managing game state in Phaser include set, get, inc, toggle, remove, merge, getAll, and query. These core APIs allow comprehensive manipulation of key-value data stored on objects, scenes, or the global registry.

Does the Phaser DataManager support persisting state through scene reloads?

Yes, the Phaser DataManager supports persisting state through scene reloads when utilizing the global registry. This ensures cross-scene state remains intact while supporting features like freezing and lazy creation for per-object storage.