Easy Chapter Generator
EnglishEspañol

Practical guide: persist a simple condition

Call ChapterManager.SetProgressState("generator_unlocked", true) after the project accepts the unlock. Require ProgressOperationResult.Success. Use the same exact ID in an Ordered Objective's Required True State or query it through GetProgressState.

Setting false deletes the exact key. Public reads return false both for a missing key and for false; this boolean contract does not expose existence. Call FlushProgress at the project's durability boundary when the backend requires it.

Practical guide: connect inventory without storing it twice

  1. 1
    Let the inventory system remain authoritative for item quantities and ownership.
  2. 2
    Create an Ordered Objective named Obtain the reactor key.
  3. 3
    Subscribe a project bridge to the inventory's confirmed item-added or condition-changed callback.
  4. 4
    When the required item condition is true and the expected Objective is Active, call TryCompleteObjective with its exact ID.
  5. 5
    If later content only needs the historical fact, also set a named boolean such as reactor_key_obtained. Do not serialize the full inventory through IProgressStore.

Useful boolean patterns

PatternConfigurationResult
Only after unlockRequired True State = generator_unlockedSkipped until the fact is true when evaluated
Only on first visitRequired False State = tutorial_seenSkipped after the fact becomes true
Mutually exclusive rowsOne requires true; adjacent alternative requires falseExactly the matching row participates
Project UI flagGetProgressState after Manager readinessRenders current cached value

Limits and failure handling

Required true row is skipped

The key is missing/false, spelled differently, or the write returned an error.

Inventory changed but Objective did not

Persistence states do not poll inventory. The bridge must forward the authoritative callback.

Data is lost after exit

Inspect SetProgressState and FlushProgress results and the custom backend contract.

Need quantities or item metadata

Store them in the inventory/save system. Use progression boolean state only for the simple condition.

Set a boolean progression state

Where to place it
Add this component to the gameplay system that owns the unlock signal.
When to call it
Call UnlockGenerator after the unlock is accepted, then inspect ProgressOperationResult.
Behavior
Use a stable non-empty key. The value supports simple Objective conditions; it is not arbitrary save-game data.
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 ProgressStateWriterExample : MonoBehaviour
{
    public bool UnlockGenerator()
    {
        ChapterManager manager = ChapterManager.Instance;
        return manager != null &&
               manager.SetProgressState("generator_unlocked", true) ==
               ProgressOperationResult.Success;
    }
}

Read a boolean progression state

Where to place it
Use this reader in UI or integration code that needs the same named condition.
When to call it
Call TryReadGeneratorState after the Manager has initialized.
Behavior
GetProgressState returns false for a missing key as well as for a stored false value; the boolean contract does not expose key existence.
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 ProgressStateReaderExample : MonoBehaviour
{
    public bool TryReadGeneratorState(out bool isUnlocked)
    {
        isUnlocked = false;
        ChapterManager manager = ChapterManager.Instance;
        if (manager == null)
        {
            return false;
        }

        isUnlocked = manager.GetProgressState("generator_unlocked");
        return true;
    }
}