CurrentObjectiveId is empty
This is valid when no Chapter is selected, a Chapter is terminal, or no current index resolves. Check nullable state and active flags.
Scripting
Read the current Chapter, Objective, states, and transition status safely from external code.
Use ChapterManager.Instance as the public observation boundary. A scene can exist before the singleton is ready, a Manager can have no selected Chapter, and a Chapter can have no active Objective after completion or failure. Check those states before dereferencing objects or displaying an ID.
Queries are instantaneous main-thread reads. They do not subscribe to future changes and do not force hydration again.
| Property | Result when absent | Use |
|---|---|---|
| CurrentChapter / CurrentChapterId | null / empty string | Selected Chapter identity |
| CurrentChapterState | nullable with no value | NotStarted, Active, Completed, or Failed |
| HasActiveChapter | false | Fast Active-state guard |
| CurrentObjective / CurrentObjectiveId | null / empty string | Current ordered record identity |
| CurrentObjectiveState | nullable with no value | NotStarted, Active, Completed, Skipped, or Failed |
| HasActiveObjective | false | Chapter and current row are both Active |
| IsTransitioning | false before accepted transition | Block conflicting project commands |
ChapterFailed when typed failure context is needed.HasActiveObjective.When listening to a component's own OnCompleted, remember the Chapter may already have advanced. Use captured pre-call context if the response needs the completed row rather than the new current row.
This is valid when no Chapter is selected, a Chapter is terminal, or no current index resolves. Check nullable state and active flags.
Hydration does not replay historical events. Render the restored snapshot after readiness.
The Objective component's event runs after Chapter acceptance and advancement. Observe Chapter.ObjectiveCompleted(index) for the pre-action index.
using System;
using System.Collections;
using System.Collections.Generic;
using OverFuture.ChapterObjectiveSystem.Chapters;
using OverFuture.ChapterObjectiveSystem.Events;
using OverFuture.ChapterObjectiveSystem.Objectives;
using OverFuture.ChapterObjectiveSystem.Persistence;
using OverFuture.ChapterObjectiveSystem.Progression;
using UnityEngine;
public sealed class CurrentProgressReaderExample : MonoBehaviour
{
public bool TryReadCurrentProgress(
out string chapterId,
out string objectiveId,
out ChapterObjective.ObjectiveState objectiveState)
{
chapterId = string.Empty;
objectiveId = string.Empty;
objectiveState = ChapterObjective.ObjectiveState.NotStarted;
ChapterManager manager = ChapterManager.Instance;
if (manager == null || !manager.HasActiveObjective ||
!manager.CurrentObjectiveState.HasValue)
{
return false;
}
chapterId = manager.CurrentChapterId;
objectiveId = manager.CurrentObjectiveId;
objectiveState = manager.CurrentObjectiveState.Value;
return true;
}
}