Show / Hide Table of Contents

Class XmlSavegameManager

The XmlSavegameManager is a component that should only ever exist once per scene.

It provides functionality for saving/loading the game's state.

The savegame's file format is xml that can be optionally compressed and/or encrypted. When working in the editor with domain reloading disabled, you MUST ensure that the script execution order handles XmlSavegameManager BEFORE SpawnedPrefab!

Inheritance
System.Object
SavegameManager
XmlSavegameManager
Inherited Members
SavegameManager.TIME_FORMAT
SavegameManager.Saving
SavegameManager.Saved
SavegameManager.SaveFailed
SavegameManager.Loading
SavegameManager.Loaded
SavegameManager.LoadFailed
SavegameManager.Ready
SavegameManager.key
SavegameManager.encrypt
SavegameManager.compress
SavegameManager.iterationsOfPBKDF2
SavegameManager.collectGarbageOnSave
SavegameManager.collectGarbageOnLoad
SavegameManager.savegamesDirectoryName
SavegameManager.savegameFileExtension
SavegameManager.savingTimeoutSeconds
SavegameManager.loadingTimeoutSeconds
SavegameManager.batchSize
SavegameManager.LoadNewestSavegame()
SavegameManager.savegamesDirectoryPath
SavegameManager.OnSave()
SavegameManager.OnLoad()
SavegameManager.OnSaving()
SavegameManager.OnLoading()
SavegameManager.OnSaveFailed()
SavegameManager.OnLoadFailed()
SavegameManager.OnReady()
SavegameManager.CheckSavegamesDirectory()
SavegameManager.GetNewestSavegame()
Namespace: GlitchedPolygons.SavegameFramework.Xml
Assembly: UnityScriptsLibrary.dll
Syntax
public sealed class XmlSavegameManager : SavegameManager

Methods

| Improve this Doc View Source

GatherSaveableComponentsInScene()

Gathers all the XmlSaveableComponents in the scene and registers them to the GlitchedPolygons.SavegameFramework.Xml.XmlSavegameManager.saveableComponents array.

Declaration
public void GatherSaveableComponentsInScene()
| Improve this Doc View Source

Load(String)

Loads a savegame file from inside the savegamesDirectoryPath.

The fileName parameter is just the savegame's file name (local to the savegamesDirectoryPath and WITHOUT THE FILE EXTENSION).

This will cause a chain reaction of method calls and procedures in order to make the loading procedure and map transition as smooth as possible.

The method registers GlitchedPolygons.SavegameFramework.Xml.XmlSavegameManager.OnNewSceneLoaded(Scene,LoadSceneMode) to the event and then loads the savegame's stored scene. A scene transition is triggered.

What happens next is that the GlitchedPolygons.SavegameFramework.Xml.XmlSavegameManager.OnNewSceneLoaded(Scene,LoadSceneMode) method is fired in the NEW scene on the OLD XmlSavegameManager instance.

That method then passes its GlitchedPolygons.SavegameFramework.Xml.XmlSavegameManager.transitorySavegame document over to the new scene's XmlSavegameManager, and calls GlitchedPolygons.SavegameFramework.Xml.XmlSavegameManager.Reconstruct on it. The old scene's XmlSavegameManager can now die safely.

Declaration
public override void Load(string fileName)
Parameters
Type Name Description
System.String fileName

The savegame's file name (WITHOUT ITS EXTENSION!). Path is local to the savegamesDirectoryPath.

Overrides
SavegameManager.Load(String)
| Improve this Doc View Source

Save(String)

Saves the game out to a time-stamped savegame file inside the savegamesDirectoryPath folder.

Declaration
public override void Save(string fileName)
Parameters
Type Name Description
System.String fileName

The savegame's file name (WITHOUT EXTENSION!)

Overrides
SavegameManager.Save(String)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX