All methods below are on the SaveManager autoload (SaveManagerBase in code). Only user-facing methods are listed (no leading underscore).
func set_value(key: StringName, value: Variant) -> voidStores a key in the in-memory KV map for the reserved slot_0 store. Does not touch disk until persist().
SaveManager.set_value(&"score", 9999)func get_value(key: StringName, default: Variant = null) -> VariantReturns a value from the KV map, or default if missing.
var s := int(SaveManager.get_value(&"score", 0))func persist() -> ErrorWrites the current KV dictionary to the slot_0 file using the atomic writer.
if SaveManager.persist() != OK:
push_error("Save failed")func clear_kv_cache() -> voidClears in-memory KV data so the next access reloads from disk.
SaveManager.clear_kv_cache()func replace_kv_data(data: Dictionary) -> voidReplaces the entire KV dictionary in memory. Does not write until persist().
SaveManager.replace_kv_data({"a": 1, "b": 2})func gather_saveable_snapshots() -> DictionaryCollects collect_snapshot() from all nodes in group savestate_saveable that expose the required methods.
var bundle := SaveManager.gather_saveable_snapshots()func persist_including_saveables() -> ErrorMerges KV data with __saveables snapshots and writes slot_0.
SaveManager.persist_including_saveables()func load_from_slot_and_apply_saveables(slot_id: StringName) -> DictionaryLoads a slot and applies __saveables entries to registered nodes.
var inner := SaveManager.load_from_slot_and_apply_saveables(&"slot_0")func apply_saveables_from_bundle(bundle: Dictionary) -> voidApplies a previously stored __saveables dictionary to scene nodes.
SaveManager.apply_saveables_from_bundle(saved["__saveables"])func write_inner_data_to_disk(path: String, inner: Dictionary) -> ErrorWrites a raw inner dictionary to a path derived from the file name (used by editor tools and advanced flows).
SaveManager.write_inner_data_to_disk("user://savestate/slot_0.bin", data)func ensure_slot_for_file_base(slot_id: StringName, file_base: String) -> voidRegisters a SaveSlot for a base file name if missing.
SaveManager.ensure_slot_for_file_base(&"myslot", "myslot")func restore_from_backup_file(main_save_path: String) -> ErrorReplaces the main file with its .bak sibling if present.
SaveManager.restore_from_backup_file("user://savestate/slot_0.bin")func create_backup_copy_for_file(main_save_path: String) -> ErrorCopies the main save bytes to main_save_path + ".bak" (replaces an existing .bak). Does not modify the main file. Used by the Save Browser Backup selected button and for slots that have no rolling backup yet.
SaveManager.create_backup_copy_for_file("user://savestate/slot_2.bin")func register_slot(slot: SaveSlot) -> voidRegisters a SaveSlot resource for use with sync load and save.
SaveManager.register_slot(my_slot_resource)func unregister_slot(slot_id: StringName) -> voidRemoves a slot from the registry.
SaveManager.unregister_slot(&"old_slot")func get_slot(slot_id: StringName) -> SaveSlotReturns the SaveSlot for an id, or null.
var sl := SaveManager.get_slot(&"slot_1")func set_default_state_for_migration(defaults: Dictionary) -> voidSets default key structure used when merging older saves forward.
SaveManager.set_default_state_for_migration({"new_stat": 0})func get_current_schema_version() -> intReturns savestate/current_version from Project Settings (defaults to 1).
var v := SaveManager.get_current_schema_version()func save_to_slot_sync(slot_id: StringName, data: Dictionary) -> ErrorSynchronously serializes and writes one slot file.
SaveManager.save_to_slot_sync(&"autosave", {"t": Time.get_ticks_msec()})func load_from_slot_sync(slot_id: StringName) -> DictionarySynchronously reads and parses one slot file into the inner data dictionary.
var d := SaveManager.load_from_slot_sync(&"autosave")func parse_save_file_buffer(processed: PackedByteArray) -> DictionaryParses decrypted inner file bytes into ok / data / schema_version (used by tools and advanced loaders).
var pr := SaveManager.parse_save_file_buffer(bytes)func debug_inspect_save_path(path: String) -> DictionaryEditor-oriented: reads a file from disk and returns previews and parsed inner dict for the Save Browser dock.
var info := SaveManager.debug_inspect_save_path("user://savestate/slot_0.bin")func debug_health_for_path(path: String) -> DictionaryReturns a summary dict (size, schema, encryption hints when Pro keys exist) for UI badges.
var h := SaveManager.debug_health_for_path(path)func register_key(
key: StringName,
expected_type: int,
default_value: Variant = null,
editor_value_hint: int = SaveManager.KV_EDITOR_HINT_AUTO
) -> voidLocks a KV key to a typeof value. set_value rejects mismatched types (int/float relaxed). Missing keys fall back to default_value in get_value. With TYPE_COLOR and KV_EDITOR_HINT_AUTO, the Save Browser Data tab shows a color picker; use KV_EDITOR_HINT_NONE to hide it for ambiguous nested values.
SaveManager.register_key(&"gold", TYPE_INT, 0)
SaveManager.register_key(&"tint", TYPE_COLOR, Color.WHITE)func unregister_key(key: StringName) -> voidfunc set_schema_migrations(migrations: Array) -> voidOrdered callables. Entry at index 0 runs when upgrading a file from schema 1 → 2, index 1 for 2 → 3, etc. Each callable receives the inner Dictionary (mutate in place).
SaveManager.set_schema_migrations([
func(d): d["mana"] = d.get("mana", 100),
func(d): d.erase("legacy_key"),
])func mark_dirty() -> voidDebounced persist after auto_save_debounce_sec seconds of quiet. Pro autoload uses async persist.
Global class addons/savestate/unix_display.gd. Formats Unix seconds (e.g. from FileAccess.get_modified_time) for labels. Wraps Time.get_datetime_string_from_unix_time; the optional use_space_separator argument is the engine’s use_space flag (date/time separator), not a UTC toggle.
var label := SaveStateUnixDisplay.format_modified_time(int(FileAccess.get_modified_time(path)))
if label.is_empty():
label = "—"func register_editor_hint(flat_path: String, hint: int) -> voidFlat dot-path (same as Save Browser Data tab) → SaveManager.KV_EDITOR_HINT_COLOR (1) so the dock shows a color picker. Persisted under save_root/.savestate_editor_hints.json.
func get_editor_hints_copy() -> Dictionaryfunc export_current_to_slot(slot_id: StringName) -> Error
func import_slot_into_runtime(slot_id: StringName) -> Errorfunc export_save_file_to_json(source_save_path: String, output_json_path: String) -> Error
func export_slot_to_json(slot_id: StringName, output_json_path: String) -> Error| Signal | When |
|---|---|
save_started / save_completed / save_failed |
Slot save lifecycle |
load_started / load_completed / load_failed |
Slot load lifecycle |
save_requested / load_requested |
KV + saveables flows |
migration_required(old_schema_version, new_schema_version) |
Loaded file schema is older than savestate/current_version |
See MIGRATION.md for migration_required.