Save and Resume a State Machine

Save a state machine only after defining which graph state, Shared Variables, and external gameplay data must survive. Restore those owners together and verify the same active flow resumes.

Choose the saved boundary

For a simple checkpoint, preserve:

  • the active State and the graph’s supported runtime data;
  • Shared Variables that represent durable progress;
  • the owner’s Transform or other project data when the graph depends on it; and
  • external Animator, inventory, quest, or scene data through the system that owns it.

Do not assume that saving the graph also serializes every referenced Component or asset.

Build the flow

  1. Add a durable checkpoint State such as Exploring or Player Turn.
  2. Save only after entry Actions have established a stable value set.
  3. Route the save command through the project save owner or the State Designer save API described on Save/Load.
  4. On load, create or locate the correct owner before restoring graph data.
  5. Restore external data in a documented order, then allow the graph to continue.

How it runs

A correct load returns to the intended State with the variables and external systems it expects. A load taken during a short transition or partially completed Action may require project-specific resumption logic; prefer stable checkpoints for the first implementation.

Verify in Play Mode

Save while a distinctive State is active and set one Shared Variable to a recognizable value. Change both the State and value, then load. Confirm that the original State and value return and that the next transition behaves as it did before saving. Repeat after reloading the scene when the production save must survive scene changes.

Troubleshooting

Symptom Check Fix
The State restores but gameplay data does not. External system ownership. Save and restore that data through its owning system.
Load finds no state machine. Owner creation and identifier timing. Create/register the owner before applying graph data.
A restored State immediately exits. Restored Condition inputs and Evaluation Mode. Restore dependent values before resuming evaluation.