Easy Chapter Generator
EnglishEspañol

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

  1. 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.
  2. Editor testing overrideIn the Unity Editor only, an enabled testing selection is used when no valid handoff exists.
  3. 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

AreaPurposeKey constraint
Testing ChapterEditor-only Chapter and optional Objective overrideHidden until enabled; never relied on in a player build
Progression DefaultsFallback Chapter when no handoff or test override resolvesMust identify a Chapter in this Manager
Progress StorageScope, profile and optional IProgressStore providerProvider replacement is locked after first progress use
Audio FeedbackOptional objective and Chapter clipsEmpty references use built-in procedural cues
Lifecycle EventsReady, before-load and failure notificationsNotifications 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.