Spawn & Wave System

v1.1.0

Save & Load

SpawnRemember — the optional GC2 Memory component that persists wave sequence progression across save/load.

Save & Load — SpawnRemember

New in 1.1.0. SpawnRemember is an optional Game Creator 2 Memory component that persists a WaveController's sequence progression, so a save/load cycle resumes the wave sequence instead of losing progress.

Entirely opt-in. Add the component to persist state; without it, nothing about SWS's behavior changes. This matches every other Wave 4 (1.1.0) addition.

Adding the Component

Add SpawnRemember to the same GameObject as the WaveControllerit should track:

  1. Select the GameObject that already has your WaveController.
  2. Add Component → Spawn Wave System → Wave Controller → Spawn Wave Sequence.
  3. Wire it into GC2's Save/Load Instructions exactly like any other Remember component — no extra configuration is required.

What Is Persisted

SpawnRemember persists the sequence progression, not the moment-to-moment run state:

FieldSource
sequenceIdThe assigned WaveSequence.SequenceId
currentWaveIndexWaveController.CurrentWaveIndex
currentLoopNumberWaveController.CurrentLoopNumber
waveStateThe current wave's WaveState
totalDefeatedCountThe package-wide SpawnManager.TotalDefeatedCount

The token round-trips through Unity's JsonUtility(SpawnRememberToken: plain serializable string/bool/int fields), the same way any other GC2 Memory component saves its state.

What Is Not Persisted (And Why)

SpawnRemember deliberately does not persist:

  • Already-spawned entities themselves.
  • A wave's in-flight spawn-list progress (which entities were queued, and their exact spawn timing).
Spawned entities and a wave's in-flight spawn-list timing cannot be resurrected across a scene load — the entities themselves are gone after the scene unloads, and the spawn list / coroutine state that was driving them is transient, in-memory data with nothing sensible to reconstruct it from.

Instead, on load WaveController.RestoreProgress(sequenceId, waveIndex, loopNumber, waveState) resumes the sequence at waveIndex if the saved wave had not finished yet, or at waveIndex + 1 if it had already Completed/Skipped/Failed (so the game does not repeat a wave the player had already cleared). The resumed wave starts fresh — the same as jumping to it with the existing SkipToWave — rather than reproducing exactly which entities were alive and where.

Safe Restore Ordering

RestoreProgress can be called before WaveController's own Start() has run — e.g. from another component's Awake()or OnRemember, which is exactly how GC2's Memory system can invoke it during scene load. In that case the request is queued and applied inside Start() instead, taking priority over AutoStart if it succeeds.

If it is called after Start() and a sequence (including one from AutoStart) is already running, the restore stops it and takes over. The SequenceId recorded at save time must match the controller's currently assigned Sequence, or the restore is silently skipped (e.g. the sequence asset was swapped out).

New public API

WaveController.RestoreProgress(string sequenceId, int waveIndex, int loopNumber, WaveState waveState);
SpawnManager.RestoreDefeatedCount(int totalDefeatedCount);

// Components
SpawnRemember
SpawnRememberToken