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.
Adding the Component
Add SpawnRemember to the same GameObject as the WaveControllerit should track:
- Select the GameObject that already has your
WaveController. - Add Component → Spawn Wave System → Wave Controller → Spawn Wave Sequence.
- 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:
| Field | Source |
|---|---|
| sequenceId | The assigned WaveSequence.SequenceId |
| currentWaveIndex | WaveController.CurrentWaveIndex |
| currentLoopNumber | WaveController.CurrentLoopNumber |
| waveState | The current wave's WaveState |
| totalDefeatedCount | The 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).
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