Save Slots Tutorial - Save Does Not Exist?

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
xanderdavis
Posts: 12
Joined: Sat Aug 10, 2013 4:48 pm

Save Slots Tutorial - Save Does Not Exist?

Post by xanderdavis »

In following the tutorial: 'Creating Save Slots using Playmaker'
http://www.moodkie.com/forum/viewtopic.php?f=4&t=11

At the 'Exists' part, PlayMaker always seems to think the save file does not exist. Am I missing something? Do I need to manually create defaultES2File.txt? I've ran through all the other steps and everything else seems to match the tutorial.
User avatar
Joel
Moodkie Staff
Posts: 4863
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by Joel »

Hi there,

Sorry to hear you've run into some problems. Firstly, please make sure that you're using the latest version of Easy Save by updating it from the Asset Store. Could you also check that the 'Unique Tag' and 'Save File' fields are set to the exact same values whenever you use an Exists, Save or Load action. There should be no whitespace before or after these.

We've checked the tutorial at our end and it's all working fine on all platforms, so hopefully there's just a small error in your FSM.

All the best,
Joel
xanderdavis
Posts: 12
Joined: Sat Aug 10, 2013 4:48 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by xanderdavis »

Hi-- I have the latest version.

For Unique Tag, I set it to 'scenenumber1' instead of 'levelnumber1' because my game is open-world. Levels wouldn't make sense. I figured this was a purely cosmetic change, as long as the label was consistent everywhere, and I double-checked that.

For Save File, the default name appears in the field: 'defaultES2File.txt' -- however, when I search for this in my Project folder, it does not exist. Do I have to create it?
User avatar
Joel
Moodkie Staff
Posts: 4863
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by Joel »

Hi xanderdavis,

That's very strange. I've just gone through the tutorial again and it's still working fine for me. What is your Built Platform set as?

Also files you save are not saved to the Assets folder, as the assets directory does not exist at runtime (as it's all compiled). Instead the file will be saved to the path specified by Application.persistentDataPath. If you could check in there to see if the data is getting saved or not and get back to me, that would be great. It may be a hidden folder, so you might have to enable hidden folders in your operating system.

If you're building to Web Player, it actually saves to PlayerPrefs, so if this is the case, you won't be able to do this. However, if you are building to Web Player, could you switch the Build Platform to PC and see if that fixes the issue? If it does, let me know.

I'm not going to be online most of tomorrow as I'm away on business, so if I don't get back to you on Wednesday evening then I'll certainly get back to you on Thursday.

All the best,
Joel
xanderdavis
Posts: 12
Joined: Sat Aug 10, 2013 4:48 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by xanderdavis »

Well almost immediately after I read your previous reply, I realized saving apparently only works on compiled builds and not in-editor. Might want to make note of that somewhere... ;)

I got it to work, HOWEVER, for some reason it only works on the second go-around. For example, if you start a New Game and Save & Quit, then go back to the Main Menu and hit Continue, it will start you at the scene for a New Game. But if you Save & Quit again, go back to the main Menu, and hit Continue, it will successfully start you from the last scene saved in from that point on every time.

So I'm guessing it's not saving the defaultES2File.txt the first time? Any advice? It works, just not on the first time. Then consistently every time after that, it does work.

Here's a screenshot of my Main Menu FSM by the way:
http://imgs.cidergame.com/20130816-mainmenu-save.png

Also, I noticed in the tutorial, we're not saving the scene number to the string it's pulling from: scenenumber1. Would this have something to do with it (not sure why we're even using that string then or how pulling from it is actually getting any useful information if we're not saving to it).
User avatar
Joel
Moodkie Staff
Posts: 4863
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by Joel »

Hi xanderdavis,

Easy Save works in Editor, so I'm not sure why yours isn't working. If you send me some screenshots of your FSM for saving, I'll see if I can work out why you're getting the unexpected behaviour.

It might be worth doing the tutorial in isolation without any of your own functionality to see if the problem persists. We've done the tutorial from scratch at our end and it's worked as expected on both Unity 3.5 and the latest version of 4.

All the best,
Joel
xanderdavis
Posts: 12
Joined: Sat Aug 10, 2013 4:48 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by xanderdavis »

Thanks for your help. Appreciated:

As I mentioned, this all works. Just not the first time. We're close!

Global Variables:
http://imgs.cidergame.com/20130816-globalvariables.png

Main Menu:
http://imgs.cidergame.com/20130816-mainmenu-save-2.png
http://imgs.cidergame.com/20130816-mainmenu-save-3.png
http://imgs.cidergame.com/20130816-mainmenu-save-4.png
http://imgs.cidergame.com/20130816-mainmenu-save-5a.png
http://imgs.cidergame.com/20130816-mainmenu-save-5b.png
http://imgs.cidergame.com/20130816-mainmenu-save-5c.png
http://imgs.cidergame.com/20130816-mainmenu-save-5d.png

WrapperManager GameObject (Persistent in all Scenes after MainMenu) - SaveManagerFSM
http://imgs.cidergame.com/20130816-wrap ... efsm-1.png
http://imgs.cidergame.com/20130816-wrap ... efsm-2.png
http://imgs.cidergame.com/20130816-wrap ... efsm-3.png
http://imgs.cidergame.com/20130816-wrap ... efsm-4.png
http://imgs.cidergame.com/20130816-wrap ... efsm-5.png
http://imgs.cidergame.com/20130816-wrap ... efsm-6.png

EgressManager GameObject (Manages all points of entry/egress so game knows where to start player in each scene)
SceneNumberFSM hardcodes the buildlist scene number since all scenes are added additively to the wrapper scene (I know, I know... that's bad to hard code the scene number, but it will work for now)
http://imgs.cidergame.com/20130816-egre ... enum-1.png
http://imgs.cidergame.com/20130816-egre ... enum-2.png
http://imgs.cidergame.com/20130816-egre ... enum-3.png

So we're really close here. Not sure why it works every time after the first time, but not the first...

PS: You're right-- I confirmed that it does work in the editor too. Just only after the first round, which is why I probably never noticed it (I would just stop the editor Playback after the first attempt when trying to rig it up in-editor).
xanderdavis
Posts: 12
Joined: Sat Aug 10, 2013 4:48 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by xanderdavis »

Think I figured it out.

By selecting NEW GAME from my main menu (which doesn't go through any of the tutorial stuff, it just loads a scene), it's bypassing the creation of the safe file, which was in the tutorial.

If I select CONTINUE instead of NEW GAME to start a new game, it will create the save file. Then when I update the last scene by SAVE & QUIT from within the game, it updates the save file CONTINUE created.

So I re-rigged New Game to do the same thing as the first step in the tutorial (save exists check), but if it does exist, then reset the variable and saves it to the file for the scene to load, which is the first designated scene.

http://imgs.cidergame.com/20130816-mainmenu-save-6.png

Since I will presumably store many more variables in a save, is there an easier way to clear / reset all saved data?
User avatar
Joel
Moodkie Staff
Posts: 4863
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Slots Tutorial - Save Does Not Exist?

Post by Joel »

I'm glad you've found the problem, though it seems a shame I couldn't have been of more assistance after you took the time to upload all of those screenshots :)

There's a Delete action which you can use to delete the entire save file. Just leave the tag blank to delete the entire file, or specify a tag if you want to delete one of the tags from inside the file.

All the best,
Joel
Locked