Save System - interrogate save slot status

Announcements, support questions, and discussion for Quest Machine.
Post Reply
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Save System - interrogate save slot status

Post 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!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System - interrogate save slot status

Post 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.
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Re: Save System - interrogate save slot status

Post by mroshaw »

That is amazing, thank you Tony! Spent some time today, and this works a treat! :)
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System - interrogate save slot status

Post by Tony Li »

Glad to help!
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Re: Save System - interrogate save slot status

Post 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!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System - interrogate save slot status

Post 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();
    }
}
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Re: Save System - interrogate save slot status

Post by mroshaw »

Superb, thanks again Tony! No more questions from me, I promise!
Post Reply