Page 1 of 1
Save System - interrogate save slot status
Posted: Tue Mar 29, 2022 8:39 am
by mroshaw
Hi again, Tony! I hope this finds you well!
I've started to implement load and save in my game, using your fabulous Save System components, alongside Quest Machine.
I wondered if there is an out-of-the-box way of interrogating the state of save slots? That is, I'd like to present a "Load Game UI" to my player, that shows what slots currently contain a game save. It would be useful to have a description and a date / time associated to that save and display that against an occupied slot.
I appreciate the Save System is a nice to have add-on, so I understand if it's up to me to build on top of it. I just wanted to see if there was anything in there already that I could use or build upon.
Thanks again!
Re: Save System - interrogate save slot status
Posted: Tue Mar 29, 2022 8:58 am
by Tony Li
Hi,
Yes, use the
SaveSystem class.
To check if there's a saved game in a slot, check SaveSystem.HasSavedGameInSlot(#).
This article provides a way to include summary info in your saved games and then show that info in a load game screen.
Re: Save System - interrogate save slot status
Posted: Tue Mar 29, 2022 11:32 am
by mroshaw
That is amazing, thank you Tony! Spent some time today, and this works a treat!
Re: Save System - interrogate save slot status
Posted: Tue Mar 29, 2022 11:52 am
by Tony Li
Glad to help!
Re: Save System - interrogate save slot status
Posted: Wed Mar 30, 2022 5:18 am
by mroshaw
Hi Tony,
Sorry to ask a cheeky follow up. Hope that's okay?
I currently have a solution in place that shows a loading screen while a scene is loading asynchronously. I do this via a "Loading Scene" that reads a static class property that's populated with the scene to load from a custom method called whenever I want to load a scene.
Is there something in Save System that allows me to hook into that, when using SaveSystem.LoadFromSlot()?
Thanks again!
Re: Save System - interrogate save slot status
Posted: Wed Mar 30, 2022 8:36 am
by Tony Li
Hi,
Yes. You can add a Standard Scene Transition Manager component to your Save System GameObject.
The first bit of
this video shows how to set it up. You can skip past the part about importing the Dialogue System and Love/Hate. That isn't necessary to set up the scene transition manager. In the video, I set up the Standard Scene Transition Manager on a child object, but it would be better to put it on the main Save System GameObject so you don't have to go digging through children to find it.
The Standard Scene Transition Manager normally loads a single loading scene assigned to its Loading Scene field.
Before calling SaveSystem.LoadFromSlot(), you can set the field. Example:
Code: Select all
SaveSystem.instance.GetComponent<StandardSceneTransitionManager>().loadingSceneName = YourStaticClass.SceneName;
SaveSystem.LoadFromSlot(#);
Alternatively, and this is my preference personally, you can make a subclass of StandardSceneTransitionManager and override the LeaveScene() coroutine so you don't have to remember to set loadingScene before every scene-changing method:
Code: Select all
public class MySceneTransitionManager : StandardSceneTransitionManager
{
public override IEnumerator LeaveScene()
{
loadingSceneName = YourStaticClass.SceneName;
yield return base.LeaveScene();
}
}
Re: Save System - interrogate save slot status
Posted: Wed Mar 30, 2022 8:49 am
by mroshaw
Superb, thanks again Tony! No more questions from me, I promise!