MapSaveLoadManager

Overview

Persists Region state without reflection using small DTOs. Can operate over an explicit regions list, or auto-discover all Region components (including inactive).

Disk File

  • regions_save.json in Application.persistentDataPath.

Region DTO

Each region is saved as:

{
  "key": "<Region.SaveKey>",
  "name": "<human-friendly>",
  "localDemand": 0.0,
  "minPoliceSeverity": 0.0,
  "minCartelSeverity": 0.0,
  "policeSeverity": 0.0,
  "cartelSeverity": 0.0,
  "control": 0.0
}

Public API

  • void SaveAll() — collects Region.Save() from all regions and writes a pretty-printed JSON wrapper.
  • void LoadAll() — reads the wrapper and invokes Region.Load(dto) for each record against discovered regions (best match by key/name).

Notes

  • Provides clear logs about how many records were saved/applied.
  • Helpful when debugging region balancing because the on-disk JSON is human-readable.