Saving Dictionary to specific file

Discussion and help for Easy Save 3
Post Reply
kymchi88
Posts: 1
Joined: Sun Jun 30, 2019 4:15 am

Saving Dictionary to specific file

Post by kymchi88 »

Hello,

Im saving multiple items to a save file. Most of it has worked easily, however, I'm having an issue saving a dictionary<int,bool> to the file along with the other items. The other examples I've seen so far look as if you need to create a new file and then use sync() to save it. Will this overwrite the old file each time? What is the syntax? Here's what I'm using so far.

the save path is the path including the filename to be created. I had to use this since mobile files have to be created in a specific file path on IOS.

ES3.Save<IDictionary<int,bool>>("levelCompDict", lvlCompleteDict, savePath); --This is the line that's not working

ES3.Save<int>("LivesLeft", numLives, savePath);
ES3.Save<int>("CoinBalance", Points, savePath);
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving Dictionary to specific file

Post by Joel »

Hi there,

You mention using Sync (which is an ES3File method), but you're using ES3.Save. if you are using ES3.Save, you do not need to create an ES3File or call Sync. ES3File is used for caching.

In your case, only the key "levelCompDict" will be overwritten.

Please could you provide more information on how it's not working? Also you may want to try providing Dictionary as the generic parameter, rather than IDictionary.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply