Concepts
Chapter Manager
Learn what the scene-level coordinator owns: discovery, startup priority, feedback, persistence, failure signals, and scene handoff.
The scene coordinator
One enabled ChapterManager coordinates the Chapters configured in its scene. It establishes the singleton, configures the progress store, hydrates known terminal progress, consumes a one-use scene handoff, chooses the startup Chapter, exposes public observation properties, routes explicit failure, and starts scene transitions. It does not interpret player input or automatically recover from failure.
The component requires ChapterAudioPlayer. If the service is absent, the Manager adds it during Awake. A second Manager logs an error and disables itself because two owners would make current state and scene handoff ambiguous.
Startup priority is deterministic
- Persisted one-use handoffA valid Chapter and optional Objective written for a scene transition have first priority. The record is consumed and flushed during hydration.
- Editor testing overrideIn the Unity Editor only, an enabled testing selection is used when no valid handoff exists.
- Default ChapterThe configured default is the final fallback. Player builds clear the Editor-only start IDs.
The handoff is deliberately stronger than the testing override. This allows a Chapter configured with Load Scene and Start Chapter or Restore Checkpoint to arrive at its intended destination even when the destination Manager still has a local testing selection enabled.
Configuration map
| Area | Purpose | Key constraint |
|---|---|---|
| Testing Chapter | Editor-only Chapter and optional Objective override | Hidden until enabled; never relied on in a player build |
| Progression Defaults | Fallback Chapter when no handoff or test override resolves | Must identify a Chapter in this Manager |
| Progress Storage | Scope, profile and optional IProgressStore provider | Provider replacement is locked after first progress use |
| Audio Feedback | Optional objective and Chapter clips | Empty references use built-in procedural cues |
| Lifecycle Events | Ready, before-load and failure notifications | Notifications do not replace result checks or policy code |
Read state without taking ownership
External code can read CurrentChapter, CurrentChapterId, CurrentChapterState, HasActiveChapter, CurrentObjective, CurrentObjectiveId, CurrentObjectiveState, HasActiveObjective, and IsTransitioning. These properties report the current snapshot; they do not subscribe the caller to future changes.
Commands return meaningful values where rejection matters: TrySelectChapter, TryFailCurrentChapter, SetProgressState, ClearProgress, FlushProgress, and TrySetProgressStore. Treat their result as part of the API rather than assuming a UnityEvent proves acceptance.