Class SaveLoadManager
Implements save/load logic.
Games are saved in PersistentDataPath\Saves.
Each save game will have a screenshot and multiple files.
Inheritance
SaveLoadManager
Assembly: Assembly-CSharp.dll
Syntax
public class SaveLoadManager : MonoBehaviour
Properties
|
Improve this Doc
View Source
CharacterCount
Declaration
public int CharacterCount { get; }
Property Value
|
Improve this Doc
View Source
CharacterNames
Declaration
public string[] CharacterNames { get; }
Property Value
|
Improve this Doc
View Source
DaggerfallSavePath
Declaration
public string DaggerfallSavePath { get; }
Property Value
|
Improve this Doc
View Source
HasInstance
Declaration
public static bool HasInstance { get; }
Property Value
|
Improve this Doc
View Source
Instance
Declaration
public static SaveLoadManager Instance { get; }
Property Value
|
Improve this Doc
View Source
IsSavingPrevented
Declaration
public bool IsSavingPrevented { get; }
Property Value
|
Improve this Doc
View Source
LatestSaveVersion
Declaration
public int LatestSaveVersion { get; }
Property Value
|
Improve this Doc
View Source
LoadInProgress
Declaration
public bool LoadInProgress { get; }
Property Value
|
Improve this Doc
View Source
StateManager
Declaration
public static SerializableStateManager StateManager { get; }
Property Value
|
Improve this Doc
View Source
UnitySavePath
Declaration
public string UnitySavePath { get; }
Property Value
Methods
|
Improve this Doc
View Source
CacheScene(String)
Stores the current scene in the SerializableStateManager cache using the given name.
Declaration
public static void CacheScene(string sceneName)
Parameters
Type |
Name |
Description |
String |
sceneName |
|
|
Improve this Doc
View Source
ClearSceneCache(Boolean)
Clears the SerializableStateManager scene cache.
Declaration
public static void ClearSceneCache(bool start)
Parameters
Type |
Name |
Description |
Boolean |
start |
True if starting a new or loaded game, so also clear permanent scene list
|
|
Improve this Doc
View Source
DeleteSaveFolder(Int32)
Declaration
public void DeleteSaveFolder(int key)
Parameters
Type |
Name |
Description |
Int32 |
key |
Save key.
|
|
Improve this Doc
View Source
DeregisterAllSerializableGameObjects(Boolean)
Force deregister all ISerializableGameObject instances from SerializableStateManager.
Declaration
public static void DeregisterAllSerializableGameObjects(bool keepPlayer = true)
Parameters
Type |
Name |
Description |
Boolean |
keepPlayer |
|
|
Improve this Doc
View Source
DeregisterSerializableGameObject(ISerializableGameObject)
Deregister ISerializableGameObject from SerializableStateManager.
Declaration
public static void DeregisterSerializableGameObject(ISerializableGameObject serializableObject)
Parameters
|
Improve this Doc
View Source
Deserialize(Type, String)
Declaration
public static object Deserialize(Type type, string serializedState)
Parameters
Type |
Name |
Description |
Type |
type |
|
String |
serializedState |
|
Returns
|
Improve this Doc
View Source
EnumerateSaves()
Updates save game enumerations.
Must call this before working with existing saves.
For example, this is called in save UI every time window pushed to stack.
Declaration
public void EnumerateSaves()
|
Improve this Doc
View Source
FindMostRecentSave()
Declaration
public int FindMostRecentSave()
Returns
Type |
Description |
Int32 |
Save key of most recent save, or -1 if no saves found.
|
|
Improve this Doc
View Source
FindSaveFolderByNames(String, String)
Finds existing save folder.
Declaration
public int FindSaveFolderByNames(string characterName, string saveName)
Parameters
Type |
Name |
Description |
String |
characterName |
Name of character to match.
|
String |
saveName |
Name of save to match.
|
Returns
Type |
Description |
Int32 |
Save key or -1 if save not found.
|
|
Improve this Doc
View Source
FindSingleton(out SaveLoadManager)
Declaration
public static bool FindSingleton(out SaveLoadManager singletonOut)
Parameters
Returns
|
Improve this Doc
View Source
GetCharacterNames()
Declaration
public string[] GetCharacterNames()
Returns
|
Improve this Doc
View Source
GetCharacterSaveKeys(String)
Gets array of save keys for the specified character.
Declaration
public int[] GetCharacterSaveKeys(string characterName)
Parameters
Type |
Name |
Description |
String |
characterName |
Name of character.
|
Returns
Type |
Description |
Int32[] |
Array of save keys
|
|
Improve this Doc
View Source
GetSaveFolder(Int32)
Gets folder containing save by key.
Declaration
public string GetSaveFolder(int key)
Parameters
Type |
Name |
Description |
Int32 |
key |
Save key.
|
Returns
Type |
Description |
String |
Path to save folder or empty string if key not found.
|
|
Improve this Doc
View Source
GetSaveInfo(Int32)
Gets save information by key.
Declaration
public SaveInfo_v1 GetSaveInfo(int key)
Parameters
Type |
Name |
Description |
Int32 |
key |
Save key.
|
Returns
Type |
Description |
SaveInfo_v1 |
SaveInfo populated with save details, or empty struct if save not found.
|
|
Improve this Doc
View Source
GetSaveScreenshot(Int32)
Declaration
public Texture2D GetSaveScreenshot(int key)
Parameters
Type |
Name |
Description |
Int32 |
key |
|
Returns
|
Improve this Doc
View Source
HasQuickSave(String)
Checks if quick save folder exists.
Declaration
public bool HasQuickSave(string characterName)
Parameters
Type |
Name |
Description |
String |
characterName |
|
Returns
Type |
Description |
Boolean |
True if quick save exists.
|
|
Improve this Doc
View Source
IsReady()
Checks if save/load system is ready.
Declaration
Returns
Type |
Description |
Boolean |
True if ready.
|
|
Improve this Doc
View Source
Load(Int32)
Declaration
public void Load(int key)
Parameters
Type |
Name |
Description |
Int32 |
key |
|
|
Improve this Doc
View Source
Load(String, String)
Declaration
public void Load(string characterName, string saveName)
Parameters
|
Improve this Doc
View Source
PromptLoadGame(String, String, Action)
Checks for a mod mismatch in a save, and displays a warning message before proceeding
Declaration
public void PromptLoadGame(string characterName, string saveName, Action loadGameAction)
Parameters
Type |
Name |
Description |
String |
characterName |
Character's name in the save
|
String |
saveName |
Name of the save to be loaded
|
Action |
loadGameAction |
The steps taken to load a save after finding no mismatches, or after user proceeds to load anyway
|
|
Improve this Doc
View Source
PromptQuickLoadGame(String, Action)
Checks for a mod mismatch in the QuickSave, and displays a warning message before proceeding
Declaration
public void PromptQuickLoadGame(string characterName, Action loadGameAction)
Parameters
Type |
Name |
Description |
String |
characterName |
Character's name in the save
|
Action |
loadGameAction |
The steps taken to load a save after finding no mismatches, or after user proceeds to load anyway
|
|
Improve this Doc
View Source
QuickLoad()
Declaration
|
Improve this Doc
View Source
QuickSave(Boolean)
Declaration
public void QuickSave(bool instantReload = false)
Parameters
Type |
Name |
Description |
Boolean |
instantReload |
|
|
Improve this Doc
View Source
RaiseOnLoadEvent(SaveData_v1)
Declaration
protected virtual void RaiseOnLoadEvent(SaveData_v1 saveData)
Parameters
|
Improve this Doc
View Source
RaiseOnSaveEvent(SaveData_v1)
Declaration
protected virtual void RaiseOnSaveEvent(SaveData_v1 saveData)
Parameters
|
Improve this Doc
View Source
RaiseOnStartLoadEvent(SaveData_v1)
Declaration
protected virtual void RaiseOnStartLoadEvent(SaveData_v1 saveData)
Parameters
|
Improve this Doc
View Source
RegisterPreventSaveCondition(Func<Boolean>)
Declaration
public void RegisterPreventSaveCondition(Func<bool> handler)
Parameters
|
Improve this Doc
View Source
RegisterSerializableGameObject(ISerializableGameObject)
Register ISerializableGameObject with SerializableStateManager.
Declaration
public static void RegisterSerializableGameObject(ISerializableGameObject serializableObject)
Parameters
|
Improve this Doc
View Source
Rename(Int32, String)
Declaration
public void Rename(int key, string newSaveName)
Parameters
|
Improve this Doc
View Source
RestoreCachedScene(String)
Restores the current scene from the SerializableStateManager cache using the given name.
Declaration
public static void RestoreCachedScene(string sceneName)
Parameters
Type |
Name |
Description |
String |
sceneName |
|
|
Improve this Doc
View Source
Save(String, String, Boolean)
Declaration
public void Save(string characterName, string saveName, bool instantReload = false)
Parameters
|
Improve this Doc
View Source
Serialize(Type, Object, Boolean)
Declaration
public static string Serialize(Type type, object value, bool pretty = true)
Parameters
Returns
|
Improve this Doc
View Source
UnregisterPreventSaveCondition(Func<Boolean>)
Declaration
public void UnregisterPreventSaveCondition(Func<bool> handler)
Parameters
Events
|
Improve this Doc
View Source
OnLoad
Declaration
public static event SaveLoadManager.OnLoadEventHandler OnLoad
Event Type
|
Improve this Doc
View Source
OnSave
Declaration
public static event SaveLoadManager.OnSaveEventHandler OnSave
Event Type
|
Improve this Doc
View Source
OnStartLoad
Declaration
public static event SaveLoadManager.OnStartLoadEventHandler OnStartLoad
Event Type
Extension Methods
MBExtensions.Invoke<T1, T2, T3, T4>(MonoBehaviour, Action<T1, T2, T3, T4>, T1, T2, T3, T4, Single)