|
|
@ -58,6 +58,8 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
protected static SaveMenu instance; |
|
|
|
protected static SaveMenu instance; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected static bool hasLoadedOnStart = false; |
|
|
|
|
|
|
|
|
|
|
|
protected virtual void Awake() |
|
|
|
protected virtual void Awake() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Only one instance of SaveMenu may exist |
|
|
|
// Only one instance of SaveMenu may exist |
|
|
@ -69,7 +71,14 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
instance = this; |
|
|
|
instance = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (transform.parent == null) |
|
|
|
|
|
|
|
{ |
|
|
|
GameObject.DontDestroyOnLoad(this); |
|
|
|
GameObject.DontDestroyOnLoad(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Debug.LogError("Save Menu cannot be preserved across scene loads if it is a child of another GameObject."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
clickAudioSource = GetComponent<AudioSource>(); |
|
|
|
clickAudioSource = GetComponent<AudioSource>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -89,8 +98,10 @@ namespace Fungus |
|
|
|
saveManager.StartScene = SceneManager.GetActiveScene().name; |
|
|
|
saveManager.StartScene = SceneManager.GetActiveScene().name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (loadOnStart) |
|
|
|
if (loadOnStart && !hasLoadedOnStart) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
hasLoadedOnStart = true; |
|
|
|
|
|
|
|
|
|
|
|
if (saveManager.SaveDataExists(saveDataKey)) |
|
|
|
if (saveManager.SaveDataExists(saveDataKey)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
saveManager.Load(saveDataKey); |
|
|
|
saveManager.Load(saveDataKey); |
|
|
|