gamestate-module

Manage Unity game state transitions and pause/resume behavior with timeScale and events.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/punkfuncgames/tetris-clone --skill gamestate-module
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gamestate-module
Source: https://github.com/punkfuncgames/tetris-clone/tree/main/.claude/skills/gamestate-module
Command: npx skills add https://github.com/punkfuncgames/tetris-clone --skill gamestate-module

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinating game state transitions, pause/resume behavior, and time scaling across systems can be error-prone and scattered; this Skill centralizes state management, ensures consistent timeScale handling, and broadcasts state events so systems remain synchronized.

Core Features & Use Cases

  • Centralized game state enum and service that exposes the current and previous state as reactive properties.
  • Automatic timeScale management: paused or game over sets timeScale to zero, other states set timeScale to one.
  • Event publishing via local reactive subjects and global MessagePipe brokers for state changes, pause, and resume events.
  • Typical use cases: toggling pause from UI, gating gameplay logic to only run when playable, reacting to level start/end, and persisting or reverting state transitions.

Quick Start

Change the current game state to Paused to freeze gameplay, set timeScale to zero, and publish pause events to subscribers.

Frequently Asked Questions about gamestate-module

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

FAQPage Schema
How do I manage Unity game state transitions and pause behavior consistently?

Pause Unity gameplay by setting the game state to Paused, which automatically sets timeScale to zero to freeze gameplay and publishes pause events to all subscribers through R3 subjects and MessagePipe brokers.

How does timeScale management work during game over or pause states?

TimeScale management automatically sets timeScale to zero during paused or game over states, and restores it to one for other states, ensuring gameplay logic stops and resumes correctly across all synchronized systems.

Do I need MessagePipe to handle pause and resume events in Unity?

MessagePipe brokers are used to globally publish and subscribe to state change, pause, and resume events, while local R3 reactive subjects also handle the event distribution for systems reacting to gameplay flow changes.

What is the best way to gate gameplay logic to only run when a game is playable?

Gate gameplay logic by checking the IsPlayable flag provided by the centralized game state service, which ensures your scripts only execute when the current Unity game state allows active gameplay.

Can I track the previous game state after a transition in Unity?

Track previous game state automatically through the state service, which exposes both the current and previous states as reactive properties, allowing you to revert or evaluate past gameplay flow transitions.