Page 1 of 1

Creating multiple saves or slots

Posted: Mon Dec 31, 2018 9:31 pm
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

Re: Creating multiple saves or slots

Posted: Tue Jan 01, 2019 9:57 am
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

Re: Creating multiple saves or slots

Posted: Wed Jan 02, 2019 6:49 pm
by Landen
Thank you so much!

I got my save slot system working great.