Visibility workflows
Exploration persistence
Capture, serialize, validate, restore, and reject incompatible explored-area snapshots.
Exploration persistence is available only when the profile uses FogVisibilityMode.Exploration. MOBA profiles do not accumulate exploration: CaptureExploration returns null, and RestoreExploration returns FogRestoreResult.ExplorationDisabled.
CaptureExploration returns a versioned FogExplorationSnapshot containing:
- format version;
- observer mask;
- bounds center and size;
- visibility resolution;
- packed explored bits;
- checksum.
The payload stores one bit per visibility cell. JsonUtility can serialize the snapshot directly.
FogExplorationSnapshot _snapshot = world.CaptureExploration();
string _json = JsonUtility.ToJson(_snapshot);
FogExplorationSnapshot _loaded = JsonUtility.FromJson<FogExplorationSnapshot>(_json);
FogRestoreResult _result = world.RestoreExploration(_loaded);Restore never silently resamples. It returns an explicit result for missing data, unsupported version, observer mismatch, bounds mismatch, resolution mismatch, or checksum mismatch. Save separate snapshots for separate observer masks or worlds.
Call ClearExploration for a new match or level. Restoring and clearing reset temporal presentation history so the visual state cannot leak from the previous snapshot.
Still stuck?
Bring the world state with you.
Include the Fog of War version, Unity and URP versions, active profile and backend, relevant logs, diagnostics, and the smallest reproducible scene.