/unity-dev:unity-scene-flowfrom unity-dev
Provides Unity scene management patterns: persistent boot scene, additive loading, pause state machine, save files with migrations, checkpoints, and object pooling.
Ships in unity-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Almost nothing should survive a scene load by staying alive. The instinct is to keep the player, the score and the managers with
DontDestroyOnLoadand carry them from scene to scene. Do the opposite: a handful of services live in one scene that is never unloaded, and everything else is destroyed and rebuilt from a short list of facts. That list is the save file. A game that can rebuild a room from data already has saving, checkpoints and a retry button; a game that keeps objects alive across loads has to invent all three later, against its own structure.
| The situation | Read |
|---|---|
"My managers are duplicated after returning to the menu"; what goes in Boot; the service registry; initialisation order; pressing Play from any scene; DontDestroyOnLoad against a persistent scene; duplicated managers | reference/bootstrap.md |
LoadSceneAsync, allowSceneActivation, what the active scene decides, unloading, "the loading screen hangs at 90%" (stuck at 0.9), scene paths, streaming neighbours, Addressables scenes | reference/additive-scenes.md |
"Pausing doesn't stop everything"; the phases and their legal transitions; what timeScale 0 stops and what it does not; backgrounding and quitting on a phone; the phase on the probe | reference/game-state-and-pause.md |
"Add a save system"; "the save got corrupted"; what a save holds and never holds; the atomic write; versions and migrations; JsonUtility limits; where the file lives | reference/save-format.md |
| "Respawn at the checkpoint"; a checkpoint as a small save; respawn without reloading; what resets; the teleport | reference/checkpoints.md |
ObjectPool<T> parameters, prewarming, resetting an instance, pooled objects in triggers, whether the pool helps | reference/pooling.md |
| Config assets, ids for kinds of thing, runtime sets, event channels; "progress resets in the build, not in the editor" | reference/scriptable-objects.md |
Music and fades across a pause; ignoreListenerPause | unity-audio → reference/music-playback.md |
| Switching action maps for the pause menu · clearing presses on resume | unity-input → reference/action-asset.md · unity-input → reference/reading-input.md |
| A menu fade that became a state machine | unity-game-ui → reference/screen-transitions.md |
Telling the camera a respawn was a cut; cameras at timeScale 0 | unity-camera → reference/update-order-and-jitter.md |
| Hit stop and slow motion beside a pause | unity-game-feel → reference/hit-stop-and-time.md |
| Baked lighting for scenes loaded together | unity-lighting → reference/bake-setup.md |
Physics.IgnoreCollision lost on a reused instance | unity-physics-3d → reference/editor-vs-build.md |
| Scheduled, completed and discarded work for a pool or a streamer | unity-profiling → reference/work-counters.md |
| Cloud saves: access classes, locks, conflicts | unity-ugs → reference/cloud-save.md |
| Scenes and atlases delivered through Addressables | unity-sprite-atlas → reference/addressables-delivery.md |
| Rooms and chunks stitched in a 2D level | unity-2d-level → reference/rooms-and-chunks.md |
| Booting a test into a moment; journeys and timelines | unity-play-harness → reference/situations.md · unity-play-harness → reference/journeys.md |
| Rules as plain data with no scene | unity-game-brief → reference/sim-presentation-split.md |
Boot scene — build index 0, never unloaded content scene — one at a time, additive
Bootstrap ─ ServiceRegistry the room, the runner, the sentry
GameState Boot·Menu·Loading·Playing· PersistentId on what the save names
Paused·Won·Lost ◄── asks for services from Start
SceneLoader load · unload · one in flight rebuilt from SaveData on every arrival
SaveStore save.json · .bak · .tmp
PickupObjectPool instances parented under it
| File | Is |
|---|---|
resources/Bootstrap.cs | The root of the Boot scene: creates the services once, in order, and the registry that hands them out |
resources/SceneLoader.cs | Additive load and unload by build path, progress, a stall limit, one operation at a time |
resources/GameState.cs | Seven phases and the table of legal transitions; owns Time.timeScale while paused unless a hit-stop owner does; plain C# |
resources/SaveStore.cs | SaveData, the migration chain, and a write that leaves the old save or the new one, never neither |
resources/PersistentId.cs | The string a save uses to name a scene object |
resources/PickupObjectPool.cs | ObjectPool<T> in Boot, with the counters that say whether it is working |
scripts/save_check.py | Reads a save from outside Unity; exit 1 on a finding |
templates/SaveRoundTripTests.cs, templates/SceneFlowJourneyTest.cs | The two gates |
Assets/Scenes/Boot.unity, first in the build's scene list: one
root object with Bootstrap, a child with PickupObjectPool, the loading screen and pause menu.
No geometry, no lights. Set firstScenePath to the menu's build path.Bootstrap.Instance.LoadContent("Assets/Scenes/GateRoom.unity")
moves the phase to Loading, unloads the old room, loads the new one additively, makes it
the active scene and arrives in Playing. Nothing else calls LoadScene, and nothing loads
in single mode.Start, never from Awake.void Start()
{
_state = Bootstrap.Get<GameState>();
_state.Changed += OnPhase; // and -= in OnDisable
}
void OnReachedGate() => _state.TryGo(GamePhase.Won); // false, and nothing happens, while Paused
PersistentId, record facts as they happen
(save.SetFlag(id.Id, 1)), and make each object able to put itself back from the save
(ResetTo(SaveData)): the same pass runs after a load and after a respawn.Bootstrap.Get<SaveStore>().Write(save, DateTimeOffset.UtcNow.ToUnixTimeSeconds()).| Gate | Asserts |
|---|---|
SaveRoundTrip (EditMode, 9 tests) | Write then read is equal; a version 1 file arrives as version 2; half a file is detected and the save before it is returned; a newer build's file is never overwritten |
GateRoom_PhaseMovesOnlyAlongLegalTransitions | The timeline's phases are exactly Boot, Loading, Playing, Paused, Playing, Won; Paused → Won is refused; nothing moves and game time stands still while paused |
Boot_SurvivesTheLevel_AndThePoolHandsBackTheSameObjects | The level unloads, Boot does not; a second unload in flight is refused; the pickups set out again are the same three objects; a new object lands in the level |
"$UNITY" -projectPath . -batchmode -runTests -testPlatform PlayMode -testFilter SceneFlowJourney \
-testResults /tmp/results.xml -logFile /tmp/tests.log
SCENEFLOW_JOURNEY_BREAK=illegal # · boot · pool — each turns one test red
python3 scripts/save_check.py "<persistentDataPath>/save.json" # exit 1 on a finding
The journey builds its scenes with SceneManager.CreateScene — no scene asset, no build-list
entry — and drives pause through ScriptedRunInput. Copy the resources/ files into one
Runtime assembly; the journey also needs the harness (unity-play-harness → resources/),
RunInput.cs and ScriptedRunInput.cs (unity-input → resources/) and
com.unity.test-framework. GameState publishes its phase on GameProbe by reflection, so the
runtime files compile with no harness in the project.
SceneLoader loads. One single-mode LoadScene unloads
Boot. Grep for it before every release.Bootstrap.Instance. Services are created in one method in dependency order
and handed out by type. Below the top, pass them; do not fetch them every frame.Awake wires an object to itself; Start talks to services. Pressing Play on a level
runs its Awake before Boot exists.progress stops at 0.9 while activation
is held, and WaitForSeconds never returns at timeScale 0.Time.timeScale follows it. Update runs at scale 0, audio plays,
input fires. Simulation checks IsPlaying or runs on the fixed step. One object writes the
scale: GameState, or — once the game has hit stop — the hit-stop owner, with
ownsTimeScale off and the phase setting its base.TryGo may say no. An illegal transition is refused and counted, never performed. One
object asks for each transition.ResetTo pass as arrival. Two ways of setting up a room are two
rooms.Created stay flat; that is the measurement.| Not here | Go to |
|---|---|
| Menus, HUD, the loading screen's look, transitions | unity-game-ui |
| Music and mixers, action assets and rebinding, Cloud Save and accounts, test situations and journeys, the brief, lightmaps, frame-time counters, Addressables delivery, 2D rooms | the handoff rows of the table at the top: unity-audio · unity-input · unity-ugs · unity-play-harness · unity-game-brief · unity-lighting · unity-profiling · unity-sprite-atlas · unity-2d-level |
| Assemblies, version control, project creation | unity-new-project |
| LOD, occlusion, batching, texture streaming | unity-scene-optimisation |
| Building a 3D level: kits, prefabs, terrain | unity-3d-level |
| What a pickup, a switch or a door does | unity-interaction |
| Damage, projectiles, hit windows | unity-combat |
| Sentry behaviour, spawners and waves | unity-game-ai |
| Hit stop, shake, particles, haptics | unity-game-feel |
| Host migration | unity-multiplayer-services → reference/session-api.md |
| Networked scene management | Out of scope (netcode APIs); topology and authority: unity-live-services → reference/multiplayer.md |
What is left is the frame the rest hangs on: what exists for the whole session, how one room replaces another, which phase the game is in, and the facts that put a room back.
reference/additive-scenes.md (opens in a new tab)reference/bootstrap.md (opens in a new tab)reference/checkpoints.md (opens in a new tab)reference/game-state-and-pause.md (opens in a new tab)reference/pooling.md (opens in a new tab)reference/save-format.md (opens in a new tab)reference/scriptable-objects.md (opens in a new tab)resources/Bootstrap.cs (opens in a new tab)resources/GameState.cs (opens in a new tab)resources/PersistentId.cs (opens in a new tab)resources/PickupObjectPool.cs (opens in a new tab)resources/PooledPickup.cs (opens in a new tab)resources/SaveStore.cs (opens in a new tab)resources/SceneLoader.cs (opens in a new tab)scripts/save_check.py (opens in a new tab)templates/SaveRoundTripTests.cs (opens in a new tab)templates/SceneFlowJourneyTest.cs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tipoli5890/game-studio --plugin unity-dev51 skills in this plugin
/unity-2d-animationSkeletal 2D characters: PSB rig, bones and weights, sprite swaps, 2D IK (2D Animation package)./unity-2d-controllerMove a 2D character: platformer jump, slopes, coyote time, moving platforms, top-down movement./unity-2d-gridGrid tactics and tile puzzles, hex or square: move range, A* paths, line of sight, turns, undo./unity-2d-level2D level layout as data: Tiled/LDtk import, rooms, endless chunks, seeded levels, jump reachability.