Page 1 of 1

Saving Dictionary to specific file

Posted: Sun Jun 30, 2019 4:20 am
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);

Re: Saving Dictionary to specific file

Posted: Sun Jun 30, 2019 8:36 am
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