KROYSDOCS
HomeWhat's newv0.1.0

SaveGame

Save games. Saves capture the running world as a delta against its level: spawned and destroyed entities, changed components, simulation state, every script's serialized fields and the data of scripts that implement ISaveable.

Kindclass
NamespaceKroys.EngineScripting
Members6
SourceSaveGame.cs
DECLARATION

Declaration

Save, Load and Autosave are requests: the engine serves them between frames, so a script can call them from any callback. Files live in the per-game save folder of the user's data folder. Without a save service (for example in the editor without one) every call returns false.

Declaration
public static class SaveGame
REFERENCE

Members

Methods
#public static bool Save(string slot, IReadOnlyDictionary<string, string>? metadata = null)
Requests a save into slot (letters, digits, '-', '_', '.'; at most 64).
returns
True when the request was accepted.
methodstatic
#public static bool Load(string slot)
Requests loading slot; the world is replaced after the current frame.
returns
True when the slot exists and the request was accepted.
methodstatic
#public static bool Delete(string slot)
Deletes a save slot.
methodstatic
#public static bool Autosave()
Requests a save into the next rotating autosave slot.
methodstatic
#public static IReadOnlyDictionary<string, string>? GetMetadata(string slot)
The metadata a slot was saved with (the dictionary passed to Save), read from the file's header without loading its world: a settings or profile save, or a slot list that shows a chapter and play time. Null when the slot does not exist, cannot be read or there is no save service. Waits for queued writes, so a save served earlier is seen.
methodstatic
#public static string[] ListSlots()
The names of the readable save slots, newest first.
methodstatic
Signatures
public static bool Save(string slot, IReadOnlyDictionary<string, string>? metadata = null)
public static bool Load(string slot)
public static bool Delete(string slot)
public static bool Autosave()
public static IReadOnlyDictionary<string, string>? GetMetadata(string slot)
public static string[] ListSlots()

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.