RuntimeSaveLoadManager
Overview
Manages save/load for runtime-instantiated objects implementing IRuntimeSaveable, such as Laboratory, Distribution Spot (code: LocalLaboratory), and Route prefabs. Each saveable writes a standardized header with PrefabType and RegionId; the manager uses this to sort and restore objects deterministically.
Disk File
runtime_save.jsoninApplication.persistentDataPath.
Related Types
interface IRuntimeSaveable { void OnSave(StringWriter); void OnLoad(StringReader); }RuntimeSaveableHelper— writes/reads header lines:PrefabType:<type>andRegionId:<id>.
Prefab Order (load first → last)
LaboratoryLocalLaboratory(= Distribution Spot)Route
Public API
void SaveAll()— finds allIRuntimeSaveable, orders them by PrefabType, captures their text payload, and writes a JSON list.void LoadAll()— reads JSON, sorts entries by PrefabType, instantiates the correct prefab, and dispatchesOnLoadfor each.
Inspector
- Assign laboratoryPrefab, localLaboratoryPrefab (Distribution Spot), and routePrefab.
- Editor adds Save Runtime Objects / Load Runtime Objects buttons.