Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Easy Save - The Complete Save & Load Asset for Unity

Discussion in 'Assets and Asset Store' started by joeltebbett, May 28, 2011.

  1. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Easy Save 2 is almost ready. We're working on the documentation, and some further testing. Once the documentation is complete enough, we're going to release a beta as an update to Easy Save for you to try out. I'll let you know more closer to the time.

    @Shallows: As it doesn't look like we're going to get Easy Save 2 out this week, we're going to have another 24 hour discount. Let me know what day you would like this to be and I'll see what I can do ;)

    Joel
     
  2. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    If there was a "LIKE" button I'd be pressing it right now.
     
  3. doomprodigy

    doomprodigy

    Joined:
    Dec 12, 2010
    Posts:
    87
    Any day after this day I have made this post. I haven't been on the forums last few days and missed you message.

    Just make another post when the discount is up and you will have my money haha,

    Peace,
     
  4. Sparty

    Sparty

    Joined:
    Aug 26, 2010
    Posts:
    82
  5. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    The 25% discount in now live, and will be up until Monday. This will be the last chance to get the discounted price, so get it while you can!
     
  6. killerbean

    killerbean

    Joined:
    Sep 12, 2011
    Posts:
    35
    Hi Joel,

    I'm using version 1 of EasySave. It works very well, except I have one major question.

    Currently, my save files are saved in /sdcard/Android/data/ and then the game's name directory.

    Right now I'm in testing mode, so I install each new build manually from the SD card. But everytime I install a new build, my save files get erased. Pretty much the whole game directory from /sdcard/Android/data/ gets deleted.

    So my question is, how can I make it so the old files don't get deleted when ever I install a new build? I'm worried that the user's progress will get deleted each time I update the apk on the android market. Is updating manually from the SD card different from updating from the Android Market? Or is there a directory that I should be saving my files to so they don't get erased?

    Thanks,
    Jeff
     
  7. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Hi Jeff,

    When you rebuild the app during development it usually deletes the old app, including any saved data. This isn't the case when you update, so it should be fine. We've never had any lost any data when updating our Android apps. Hope this helps!

    All the best,
    Joel
     
  8. killerbean

    killerbean

    Joined:
    Sep 12, 2011
    Posts:
    35
    Thanks Joel,

    I was hoping that was the case. That's good to know.
    Jeff
     
  9. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Hi Joel

    Any word yet on the arrival of ES2?!
    Thanks!
     
  10. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Hi Mangoblue,

    We're waiting for our writer to get back to us with the words for the documentation, so hopefully Easy Save 2 will be here by tomorrow.

    Thanks for your patience everyone!
     
  11. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Ehe, couldn't resist. Bough EasySave a week ago, but still didn't use it. Eagerly waiting for EasySave 2: it looks already awesome :)
     
  12. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    HI again

    I'm curious - in an App, can you use a combination of saving some items to playerPrefs, and others using EasySave? Or is it all or nothing. On one of our apps, we have general stuff going to PlayerPrefs we don't really care about, but want to use ES for the encryption on the important info (such as number of coins picked up or purchased from the App store).

    *edit* Also, where does the .txt file save to? PlayerPrefs on iOS goes to Library>Preferences, but i can't find the txt file i've been saving to anywhere (would like to delete so i can start with fresh numbers etc for testing)

    Lastly, (sorry for all the questions), when I use EasySave.getAllFiles() it only returns "System.String[]" .. Isn't it supposed to list files?

    Cheers
     
    Last edited: Feb 28, 2012
  13. fanjules

    fanjules

    Joined:
    Nov 9, 2011
    Posts:
    167
    I just bought Easysave 1, not realising a version 2 will be here any minute. Good to see an update will be applied automatically. :)

    However, reason I am here is to ask will EasySave 2 support random read/write of a file? Version 1 appears to be just a memory stream which is dumped as a file (presumably why use of "Append" came with a performance warning). That's okay for simple stuff, but we always want more. ;)

    So, imagine if I have a 50mb file and just want to extract 50 bytes from file position starting say, 27,566,235. And maybe a second later want to pull out some more bytes from somewhere else. Imagine a big game world - this is just the sort of thing you might need to do. At the moment I would have to load the whole thing into memory, which obviously wouldn't do on memory-limited platforms such as mobile. Will I be able to do random read/write with version 2?? Or am I setting up the specification for Easy Save 3? ;)
     
  14. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    I'm currently a one-man team doing the documentation as everyone else is working on a rush job that came in, so I'm getting there slowly. I'm developing the website alongside the documentation too, which is slowing down things somewhat. I really don't want to release it in a half-finished state, so please bear with me.
     
  15. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    If more is what you want, then more is what you're going to get .... eventually! ;)

    We've got a low memory mode on our list of things to do. Technically it shouldn't be difficult to do (just use FileStreams instead of MemoryStreams). In Easy Save 2 you will be able to read from any point in a file using tags (see my earlier post), but at the moment it will load the entire file into memory as for 99% of people, this will be the most efficient way of doing things.

    Edit: Let me add, it is fairly high up on our To-Do list!
     
  16. fanjules

    fanjules

    Joined:
    Nov 9, 2011
    Posts:
    167
    Thanks for your prompt response. Also, is there an easy way on Windows and Mac to get the folder which the executable lives in?
     
  17. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    This post on UnityAnswers might answer your question.

    If you want to get the default save path, you can use Application.persistentDataPath. In Easy Save 2 you will be able to see where a certain file will be saved by entering your filename/file path into the drag-and-drop Easy Save Auto Save object and going to "Advanced Settings -> Path Data" within that object. This will tell you the save location (or save key if saving to PlayerPrefs), whether Easy Save thinks your path is relative or absolute, whether it thinks it's a URL and a few other things too.
     
  18. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Heya - wondering if you're able to answer my questions above? Would appreciate it very much! Sorry if my questions are a bit noobish!

    Thanks.
     
  19. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Sorry mangoblue, I must have missed your post!

    You can use a combination of PlayerPrefs and saving to File.

    iOS saves to /var/mobile/Applications/your-app-id/Documents by default. Calling Debug.Log(Application.persistentDataPath) and looking at the console will show you what your path with app id is. However, if you want to delete all data for an app, the easiest way is to delete the app by pressing and holding the icon in iOS, and then pressing the 'x' that appears. It will ask you if you want to delete the app's data.

    EasySave.getAllFiles() returns a list of all of the filenames in the default directory, so it returns an array of names (string).

    All the best,
    Joel
     
  20. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Hey,

    seeing that the release of EasySave 2 is being postponed, I was wondering if I could start using EaseSave 1 for my project, and then simply replace it with EaseSave 2. Is it possible (meaning: will EasySave 2 use the same method signatures as EasySave 1, thus replacing the library will update the engine), or I should wait for the release of EasySave 2?

    Thanks and good work :)
     
  21. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    It really won't be long now. Literally just finishing up the documentation. The reason it's taking so long is that I'm manually formatting all of the example code in HTML as no current code formatters appear to be up to the job.

    You can use Easy Save 1 code with Easy Save 2, but it will use the EasySave 1 engine. It won't be difficult to convert code from 1 to 2, but if you can wait, I would wait :)

    Thanks,
    Joel
     
  22. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Thanks Joel, will wait then :)

    And: manual code formatting! I wouldn't want to be in your shoes :p Just as an advice, you might find Aptana Studio (free and open source) very useful for that: it has a snippets system that you can write with Ruby (and it's quite easy: I don't know Ruby, but got the hang of it in a few minutes), and which can "envelope" a selection, thus allowing you to select some words, and envelope them with the desired span/div/else you snippeted. I used it for the first time while making HOTween's documentation, and it really gave me a great hand on that.
     
  23. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Thanks Joel!

    In the docs, "EasySave.save(string[] param, string filename, Mode m=0)", what does "Mode m=0" mean?

    So far so good for me, too... ES1 is working well for me.. still some teething issues on my end but coming together slowly :)

    Cheers
     
  24. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Hi again,

    Mode m=0 means that it defaults to the first Easy Save mode, which is Overwrite. If you wanted to Append, you could do:
    EasySave.save(myData, "myFile.txt", EasySave.Mode.Append);

    Joel
     
  25. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Thanks for the link, it sounds pretty great. What we usually do is set our intern(s) the task of creating a bespoke formatter, but unfortunately this year we've been so busy that this hasn't been possible at such short notice.
     
  26. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Good News! The Easy Save 2 Beta has just been submitted to the Asset Store, so expect it to be active on Monday/Tuesday. There are features which aren't documented, but we've not included them yet as we want to get the basic structure tested first.

    In the meantime, you can check out the documentation here on the Easy Save page.

    Let us know what you think,
    Joel
     
  27. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Awesome! Can't wait to start implementing it. Going through the documentation right now (which, I have to say, is a pain to read because of the font, probably because I'm on a Pc instead than a Mac, where the font legibility is quite different - luckly Chrome allows me to change the style of a page and use another font :p).
     
  28. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    I'll see about getting the font changed to something a bit less offensive :)
     
  29. fanjules

    fanjules

    Joined:
    Nov 9, 2011
    Posts:
    167
    Yup, same problem here - fine on mac, but on Windows the font text has a lot less weight (basically thinner lines to the text) that makes it hard to read.

    However, this may be a browser thing rather than OS... it's okay on IE9 on Windows, not too bad on Firefox, but quite painful to read in Chrome. On Mac Safari and Chrome look about the same but I don't have Firefox installed there.

    You can't beat good old Arial or Verdana. :p
     
  30. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    And just to complete fanjules browser report, on IE8 the font is instead simply not applied (appears with the default browser font).
     
  31. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Hi
    Trying to access your documents online today, but receiving a can't access error.

    Anyway, I'm getting a bit confused over the save/load functions.

    I want to save the following data for the player... (At this stage i only want one to save for one save game) :
    -high score (int)
    -items collected (int)
    -other game stats (e.g. number enemies killed) (int)

    How can I savel/load all of this to one file? Do i have to create an array of the above? I tried "highScore = EasySave.loadInt( highscore, "globalGeneralData.aqi" )" but that's not allowed (to have the highscore param in there).

    Note that i also intend to use encryption on all save files.

    Cheers for the help.
     
  32. hima

    hima

    Joined:
    Oct 1, 2010
    Posts:
    183
    Maybe there's other way to deal with this through EasySave, but here's what I did and it works pretty well for me :
    - Create a Dictionary or Hashtable for storing a save data
    - Serialize the data structure into JSON or YAML or XML string
    - Use EasySave to write the string to a file with encryption

    This way, you can store many type of data in one file. Loading the save file is as easy as loading a file as a big string by EasySave then parse the string with the parser of your choice. I use JSON with MiniJSON which can be found here
     
  33. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Thanks HIm appreciate your help.

    Unfortunately, I'm still 'new' when it comes to arrays etc - trying to get my head around them - and most of what you said went right over my head :p

    The only way i see (for a simpleton like me) is a separate file for each value - but that seems a waste... Not sure if that's very efficient either.

    Cheers

    EDIT: I've solved this by using a an array of string names married to an array of int values. HImatako, if this is what you meant, then thanks. (I didn't use JSON, or XML etc however).
     
    Last edited: Mar 4, 2012
  34. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Just want to triple check it's the page, not my net, that's having a hissy fit.

    Can anyone else access http://www.moodkie.com/easysave/save.php

    EDIT: Oh, it seems theres a new website in progress.

    Joel, any way of getting hold of the documentation offline? I really need it!
     
    Last edited: Mar 4, 2012
  35. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Hi mangoblue,

    Sorry about that. I've put the original documentation up at http://www.moodkie.com/old/easysave/, and there's a link for it on the new Moodkie page. Also with Easy Save 2 you will be able to save multiple types to a file easily. If you need to use Easy Save 1, Himatako's method will be the best.

    All the best,
    Joel
     
  36. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Great, thanks Joel. I'll look forward to ES2 then, because i have nfi about hima's method :p lol
     
  37. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    The Easy Save 2 Beta is now available on the Asset Store, simply update Easy Save to get it. As it's in beta, if you find a bug, need some help or have a suggestion then please email me direct at moodkie.com/contact instead of posting the issue on these forums.

    We have tested it throughly before releasing it as beta, so hopefully there shouldn't be any problems!
     
    Last edited: Jun 1, 2017
  38. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Trying out EasySave 2 right now :) I have a doubt: I understand that Dictionaries of supported types are ok, and Lists too, but what about a Dictionary containing a List (meaning: Dictionary<int,List<int>>): is that supported?

    [EDIT]
    Made a test and answered myself: nope, not supported. I'll use a Dictionary plus an external List.
    Anyway, as of now, EasySave 2 looks awesome, and is definitely sending me good vibes :)
     
    Last edited: Mar 5, 2012
  39. tnaseem

    tnaseem

    Joined:
    Oct 23, 2009
    Posts:
    144
    Good work on ES2, Joel.

    I'm converting my stuff across to using that. Just a question, if I may...

    In my character customiser, I want to save the character name and an array of strings of the part names added to the character. In ES1, I was simply copying everything to one string array and saving that (then parsing out in the load, knowing that the first string was the name).

    Looking at ES2, you now have tags. So was wondering if you can see any problems in doing the following (I'm mainly worried about appending to existing save files):

    Code (csharp):
    1. // charName is a String
    2. ES2.Save(charName, "player.dat?tag=name");
    3.  
    4. // charParts is an array of Strings
    5. ES2.Save(charParts, "player.dat?tag=parts&savemode=append");
    6.  
    I'm thinking of appending to this file in future with other aspects of the player (unlocks, current level, etc) and separating with tags, rather than having multiple files for the player, which is what I'm doing in ES1.

    I know you were advising against appending to existing files in ES1, so wondering if the same applies for ES2.

    Cheers,
    Taz
     
  40. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    It's not supported yet, but will be in the future. At the moment we're doing arrays/collections and objects as two different 'routes' through Easy Save as this makes it easier for debugging. We're hoping that eventually you will only require a single Load function and we'll be able to ignore LoadArray/LoadDictionary etc.
     
  41. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Hi Taz,
    I've got your email and I'll respond to it a little later when I have a bit of time to investigate. With regards to your last question, ES2 is the other way round. Appending is now more efficient than overwriting in most cases, BUT we've not yet finished the LoadAll function which will let you take advantage of appending. More info on this when we develop it a bit further.
    Thanks,
    Joel
     
  42. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Because it's in Beta, not sure if a noob like me should wait until it's Final? Only now getting my head around ES1, so not so sure what the difference will be with ES2 atm?
     
  43. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    ES2 when finished will be easier than ES1, but at the moment we're still finalising the structure so a few things will change before it's final. For the time being I would stick with ES1 until we get a little more documentation up.

    A big thanks to everyone who has sent us feedback on ES2 so far. I'll be working through your enquiries later!
     
  44. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Thanks Joel, I'll keep cruising with ES1 and will keep one eye on this thread for Final!

    Cheers!
     
  45. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi Joel!

    Now that 3.5 allows access to audio data, will you implement a SaveAudioClipToWav type function? I've posted a script to that effect here http://forum.unity3d.com/threads/119295-Writing-AudioListener.GetOutputData-to-wav-problem in case. It's basicaly a SaveListenerAudioToWav script.

    MixAndSaveAudioClips(clips:AudioClip[], offsets: int[], volumes:float[], pan: float[]) could be pretty handy too!

    Would definitely buy if such functions are implemented, and probably will anyway...

    Other questions: any decent file manager plugins for iOS? And wifi sync of files? Couldn't find anythng sleek, but maybe I haven't looked enough...

    Cheers!

    Gregzo
     
  46. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    We'll definitely be supporting the saving and loading of audio, though we're waiting for 3.5 to come out of beta before coding it up as it's likely that a few things will change.

    We've been considering creating a cross-compatible File Manager to go with Easy Save, but we're concentrating on getting the functional aspects completed first. I've put it on our To Do list anyway :)

    I know from experience that Wi-Fi syncing can be a real pain, especially in a cross-compatible way, so I wouldn't expect this one from us anytime soon. If someone else made a plugin for it, I'm sure we'd find a way to get it to cooperate with ES2 though ;)
     
  47. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    3.5 is out of beta since a couple of weeks. They just forgot to send newsletters to some users (like me) :)
     
  48. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    Thanks for letting me know, I didn't receive a newsletter either. It's downloading as we speak!
     
  49. joeltebbett

    joeltebbett

    Joined:
    Oct 18, 2009
    Posts:
    508
    A new update to the beta has been submitted to the Asset Store and will either be with us tonight, or on Monday.

    Now there are LoadAll methods. They let you load all data from a file with a given tag (as long as they're all the same type). If you're appending to a file, you'll need these functions to load all of your data.

    Huge thanks to all who have been trying out Easy Save 2. It seems that the beta is very reliable, so we're going to start rolling out some more features over the next week or so. Then it's release time! :)
     
    Last edited: Mar 9, 2012
  50. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Hi Joel
    Just want to commend you for your speed of responses, updates, and your help. With some plugins, the assistance you receive is either non-existent or thwart with negativity towards non-programmers like myself.

    Just wanted to say thanks for setting a high standard. Do you plan on making any other kinds of plug-ins in the future?