|
|
|
@ -58,6 +58,8 @@ namespace Fungus
|
|
|
|
|
|
|
|
|
|
protected static SaveMenu instance; |
|
|
|
|
|
|
|
|
|
protected static bool hasLoadedOnStart = false; |
|
|
|
|
|
|
|
|
|
protected virtual void Awake() |
|
|
|
|
{ |
|
|
|
|
// Only one instance of SaveMenu may exist |
|
|
|
@ -69,7 +71,14 @@ namespace Fungus
|
|
|
|
|
|
|
|
|
|
instance = this; |
|
|
|
|
|
|
|
|
|
GameObject.DontDestroyOnLoad(this); |
|
|
|
|
if (transform.parent == null) |
|
|
|
|
{ |
|
|
|
|
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>(); |
|
|
|
|
} |
|
|
|
@ -89,8 +98,10 @@ namespace Fungus
|
|
|
|
|
saveManager.StartScene = SceneManager.GetActiveScene().name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (loadOnStart) |
|
|
|
|
if (loadOnStart && !hasLoadedOnStart) |
|
|
|
|
{ |
|
|
|
|
hasLoadedOnStart = true; |
|
|
|
|
|
|
|
|
|
if (saveManager.SaveDataExists(saveDataKey)) |
|
|
|
|
{ |
|
|
|
|
saveManager.Load(saveDataKey); |
|
|
|
|