Creating multiple saves or slots

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
Landen
Posts: 2
Joined: Mon Dec 31, 2018 9:18 pm

Creating multiple saves or slots

Post by Landen »

Hello,

I've figured out how to save and load stuff but I was wondering how I would go about making multiple save slots. It surprised me how little information I could find about this. All I need is some example code or another post about this that could get me on the right track.

Thanks in advance!
-Landen
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Creating multiple saves or slots

Post by Joel »

Hi Landen,

To create save slots you simply need to specify a separate file for each save slot and save and load using that file. For example, when the player selects a save slot, you could put the filename into a static variable. i.e.
if(playerPressesSlot1Button)
    saveSlot = "slot1.json";
else if (playerPressesSlot2Button)
    saveSlot = "slot2.json";
And then when you come to save and load, simply use the filename specified by this static variable.
ES2.Save(myData, saveSlot + "?tag=myData");
myData = ES2.Load<string>(saveSlot + "?tag=myData")
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Landen
Posts: 2
Joined: Mon Dec 31, 2018 9:18 pm

Re: Creating multiple saves or slots

Post by Landen »

Thank you so much!

I got my save slot system working great.
Locked