Table of Contents

Class SaveManager

Namespace
Core.SaveLoad
Assembly
Core.dll

ENGINE LAYER - Orchestrates save/load operations across all systems

Responsibilities:

  • Coordinate OnSave/OnLoad calls to all systems (via SystemRegistry)
  • Serialize/deserialize SaveGameData to disk (binary format)
  • Manage save file paths and naming
  • Atomic writes (temp file → rename to prevent corruption)
  • Version compatibility checks

Architecture:

  • Pure orchestrator, doesn't own game state
  • Systems serialize their own data via OnSave/OnLoad
  • Dependency order handled by SystemRegistry
  • GAME layer hooks OnPostLoadFinalize for game-specific finalization

Usage: saveManager.SaveGame("my_save"); saveManager.LoadGame("my_save"); saveManager.QuickSave();

public class SaveManager : MonoBehaviour
Inheritance
object
SaveManager

Fields

OnDeserializePlayerState

public Action<byte[]> OnDeserializePlayerState

Field Value

Action<byte[]>

OnPostLoadFinalize

public Action OnPostLoadFinalize

Field Value

Action

OnSerializePlayerState

public Func<byte[]> OnSerializePlayerState

Field Value

Func<byte[]>

enableHotkeys

[Tooltip("Enable hotkey handling (disable if using custom input system)")]
public bool enableHotkeys

Field Value

bool

logSaveLoadOperations

[Tooltip("Enable debug logging for save/load operations")]
public bool logSaveLoadOperations

Field Value

bool

quickLoadKey

[Tooltip("Key for quick load")]
public KeyCode quickLoadKey

Field Value

KeyCode

quickSaveKey

[Header("Hotkeys")]
[Tooltip("Key for quick save")]
public KeyCode quickSaveKey

Field Value

KeyCode

saveFileExtension

[Header("Configuration")]
[Tooltip("Save file extension (without dot)")]
public string saveFileExtension

Field Value

string

Methods

DeleteSave(string)

Delete save file

public bool DeleteSave(string saveName)

Parameters

saveName string

Returns

bool

GetSaveFileNames()

Get list of all save files

public string[] GetSaveFileNames()

Returns

string[]

LoadGame(string)

Load game from file

public bool LoadGame(string saveName)

Parameters

saveName string

Returns

bool

QuickLoad()

Quick load (F9 hotkey) - loads from "quicksave.sav"

public bool QuickLoad()

Returns

bool

QuickSave()

Quick save (F5 hotkey) - saves to "quicksave.sav"

public bool QuickSave()

Returns

bool

SaveGame(string)

Save game to file

public bool SaveGame(string saveName)

Parameters

saveName string

Returns

bool