Search Unity

Easy Save - The Complete Save Data & Serialization Asset

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

  1. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Thanks for the feedback Gregzo. I'm going to have a discussion with the rest of the team about restructuring the docs. I'll also bring up the LoadFromResources method.

    All the best,
    Joel
     
  2. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    Can I save a character prefab with this or character data? The reason I ask is because in my game you can add/parent items to a customized character. I have been shopping for a saving solution.

    Thanks
     
  3. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    You would need to save each of the properties you want to restore from that prefab. Then you would need to reinstantiate the prefab, load the properties you saved and assign them to your prefab.

    Because the instance ID in Unity generally changes every time you reload the app, there's no way of automatically restoring the parent/child hierarchy of a group of objects. You would have to manually add the parenting I'm afraid.
     
  4. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    So if generated a array of items to restore then your tool could be used to reload the items for re-construction and to save the items before the game is exited?

    Thanks
     
  5. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    That is right, though the technicalities of it depends on your implementation. Here's a list of types which can be loaded and saved using Easy Save.
     
  6. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    I can't setup EasySave for JS. Here is a screen



    Errors go away if I do not move EasySave Folder.
     
    Last edited: Aug 15, 2012
  7. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi there,

    Please place the Easy Save folder into a folder called 'Standard Assets'. This should fix your problem.

    Regards,
    Joel
     
  8. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Sorry, just realised that you've already placed it in a folder called Standard Assets. Try placing it in Standard Assets (Mobile).
     
  9. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    Worked! Thank you.
     
  10. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    AutoSave do not work on mobile.
     
  11. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi there,

    Could you please provide a bit more information on the issue?

    All the best,
    Joel
     
  12. gregzo

    gregzo

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

    Having an issue whilst trying to load lists of ints and strings in append mode (Easy Save Wrong Type Exception : Expected String but found Int32).

    I've looked at my code again and again, couldn't find the problem... here's the script, I've included the class declaration for the type I'm trying to serialize at the end. Nothing fancy : String, and 2 List.<int>. II kinda hope it'll turn out to be one of these embarassing face palmers, but it might be a bug...

    Many thanks,

    Gregzo

    Code (csharp):
    1. #pragma strict
    2.  
    3. private var saveSettings : ES2Settings;
    4.  
    5. private var tags : String[];
    6.  
    7. var fileName : String;
    8.  
    9. private var filePath : String;
    10.  
    11. function Awake ()
    12. {
    13.     saveSettings = new ES2Settings();
    14.     saveSettings.encrypt=false;
    15.     saveSettings.saveLocation = ES2.SaveLocation.File;
    16.     saveSettings.saveMode = ES2.SaveMode.Append;
    17.    
    18.     tags = new String[3];
    19.    
    20.     for(var i:int=0;i<tags.length;i++)
    21.     {
    22.         tags[i]=i.ToString();
    23.     }
    24. }
    25.  
    26. function Start()
    27. {
    28.     filePath = SaveManager.using.savePath+"/"+fileName;
    29. }
    30.  
    31. function Save(presets : List.<RythmPreset>) //This works fine, it seems...
    32. {
    33.     if(SaveExists())
    34.     {
    35.         ES2.Delete(filePath);
    36.         print("deleted "+filePath+" to overwrite new data");
    37.         yield;
    38.     }
    39.    
    40.     for(preset in presets)
    41.     {
    42.         saveSettings.tag = tags[0];
    43.         ES2.Save(preset.name,filePath,saveSettings);
    44.        
    45.         saveSettings.tag = tags[1];
    46.         ES2.Save(preset.notesValueRatios,filePath,saveSettings);
    47.        
    48.         saveSettings.tag = tags[2];
    49.         ES2.Save(preset.offsetRatios,filePath,saveSettings);
    50.     }
    51. }
    52.  
    53. function Load(presets : List.<RythmPreset>) //This throws an exception
    54. {
    55.     saveSettings.tag = tags[0];
    56.     var names : String[] = ES2.LoadAll.<String>(filePath,saveSettings); //Right here
    57.    
    58.     saveSettings.tag = tags[1];
    59.     var values : List.<int>[] = ES2.LoadAllList.<int>(filePath,saveSettings);
    60.    
    61.     saveSettings.tag = tags[2];
    62.     var offsets : List.<int>[] = ES2.LoadAllList.<int>(filePath,saveSettings);
    63.    
    64.     for(var i:int=0;i<names.length;i++)
    65.     {
    66.         var loadedPreset = new RythmPreset(names[i],values[i],offsets[i]);
    67.        
    68.         presets.Add(loadedPreset);
    69.     }
    70. }
    71.  
    72. function SaveExists()
    73. {
    74.     if(ES2.Exists(filePath,saveSettings))
    75.     {
    76.         return true;
    77.     }
    78.     else
    79.     {
    80.         print("no save found");
    81.     }
    82. }
    83.  
    84. class RythmPreset
    85. {
    86.     var name : String;
    87.     var notesValueRatios : List.<int>;
    88.     var offsetRatios : List.<int>;
    89.    
    90.     function RythmPreset(nam:String,notVal:List.<int>,offs:List.<int>)
    91.     {
    92.         name = nam;
    93.         notesValueRatios = notVal;
    94.         offsetRatios = offs;   
    95.     }
    96.    
    97.     function RythmPreset()
    98.     {
    99.         notesValueRatios = new List.<int>(7);
    100.         offsetRatios = new List.<int>(7);
    101.     }
    102. }
     
  13. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi gregzo,

    At the moment LoadAll only works when saving data of the same type. I very much advise using multiple calls to the Load.

    LoadAll is likely to be deprecated when ES2 comes out of beta, and we removed it from the documentation a couple of months ago. The performance advantage over multiple calls to Load is negligible, and the inherent nature of it means it has the potential to create errors which are very difficult to debug.
     
  14. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Ok, I understand. A shame, it was very handy to load unknown number of lists...

    So append mode be deprecated too, then? Too bad... I was going to suggest an overwrite on a precise index when overwriting in a file containing appended data.

    Is there really no way to make append and loadall work reliably in the final release? I still value my buy, but have to code quite a bit more than expected to serialize classes. I'm sure that if you can manage more detailed append/overwrite/loadall behaviours for multiple types in the same file, your product will be all the more sought after!

    Cheers,

    Gregzo
     
  15. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Just posting the same script, corrected to avoid LoadAll methods. Might be helpful to someone some day...
    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. private var saveSettings : ES2Settings;
    5.  
    6. var fileName : String;
    7.  
    8. private var filePath : String;
    9.  
    10. private var nbOfPresetsTag : String = "N"; //tag prefixes, to be completed when the number of instances to serialize is known
    11. private var nameTag : String = "n";
    12. private var valueTag : String = "v";
    13. private var offsetTag : String = "o";
    14.  
    15.  
    16. function Awake ()
    17. {
    18.     saveSettings = new ES2Settings();
    19.     saveSettings.encrypt=false;
    20.     saveSettings.saveLocation = ES2.SaveLocation.File;
    21.     saveSettings.saveMode = ES2.SaveMode.Overwrite;
    22.    
    23.  
    24. }
    25.  
    26. function Start()
    27. {
    28.     filePath = SaveManager.using.savePath+"/"+fileName;
    29. }
    30.  
    31. function Save(presets : List.<RythmPreset>)
    32. {
    33.     if(SaveExists())
    34.     {
    35.         ES2.Delete(filePath);
    36.         print("deleted "+filePath+" to overwrite new data");
    37.         yield;
    38.     }
    39.    
    40.     saveSettings.tag = nbOfPresetsTag; //The number of preset in presets, sum
    41.     ES2.Save(presets.Count,filePath,saveSettings);
    42.    
    43.     for(var i:int=0;i<presets.Count;i++)
    44.     {
    45.         print("saving "+presets[i].name+" preset");
    46.         saveSettings.tag = nameTag+i.ToString();
    47.         ES2.Save(presets[i].name,filePath,saveSettings);
    48.    
    49.         saveSettings.tag = valueTag+i.ToString();
    50.         ES2.Save(presets[i].notesValueRatios,filePath,saveSettings);
    51.  
    52.         saveSettings.tag = offsetTag+i.ToString();
    53.         ES2.Save(presets[i].offsetRatios,filePath,saveSettings);
    54.     }
    55. }
    56.  
    57. function Load(presets : List.<RythmPreset>)
    58. {
    59.     saveSettings.tag = nbOfPresetsTag;
    60.     var nbOfPresets : int = ES2.Load.<int>(filePath,saveSettings);
    61.    
    62.     print("trying to load "+nbOfPresets+" presets");
    63.    
    64.     for(var i:int=0;i<nbOfPresets;i++)
    65.     {
    66.         var loadedPreset = new RythmPreset();
    67.        
    68.         saveSettings.tag = nameTag + i.ToString();
    69.         loadedPreset.name = ES2.Load.<String>(filePath,saveSettings);
    70.        
    71.         saveSettings.tag = valueTag + i.ToString();
    72.         loadedPreset.notesValueRatios = ES2.LoadList.<int>(filePath,saveSettings);
    73.        
    74.         saveSettings.tag = offsetTag + i.ToString();
    75.         loadedPreset.offsetRatios = ES2.LoadList.<int>(filePath,saveSettings);
    76.        
    77.         presets.Add(loadedPreset);
    78.     }
    79. }
    80.  
    81. function SaveExists()
    82. {
    83.     if(ES2.Exists(filePath,saveSettings))
    84.     {
    85.         return true;
    86.     }
    87. }
     
    Last edited: Aug 17, 2012
  16. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    I simply set AutoSave to a GameObject but nothing happened.

    Here is another problem trying to load a boolean:

    Code (csharp):
    1.  
    2. canLoad = ES2.Load<bool>("keyCanLoad");
    3.  
    He cannot find bool type

    NEWS:

    I changed my script

    Code (csharp):
    1.  
    2. canLoad = ES2.Load.<bool>("keyCanLoad");
    3.  
    Here is the new error:

     
    Last edited: Aug 19, 2012
  17. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    In C#, ES2.Load<bool>
    in JS, ES2.Load.<boolean>

    JS needs the period(.) between Load and <Type>, C# doesn't.
    JS boolean, C# bool.

    You're mixing the two...

    Plus I suggest you use ES2Settings, very convenient. See my script above for an example (JS).
     
  18. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    @joeltebett

    Hi, I hope you're well.

    Another small suggestion :

    Since EasySave provides a way to delete files/folders, it'd be really handy to be able to rename them as well. I'm using a folder system to save seperate "sessions" (music making app), and it seems it shouldn't be difficult to implement at all! It's nice to be able to channel file I/O through EasySave...

    Any news on the next update?

    Cheers,

    Gregzo
     
  19. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    +1, we too could use the ability to rename folders.
     
  20. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi, in case of need here's a quick fix:

    Code (csharp):
    1. #pragma strict
    2.  
    3. import System;
    4. import System.IO;
    5.  
    6. function RenameFolder(prevName:String,newName:String,dirPath:String)
    7. {
    8.     var myDir : DirectoryInfo = new DirectoryInfo(dirPath);
    9.      
    10.     if (Directory.Exists(dirPath+"/"+newName) == false)
    11.     {
    12.          sessionDir.MoveTo(savePath+"/"+newName);
    13.     }
    14. }
    It might save you time, as renaming directories in .net is actualy done by moving them (yep...), so the function above actualy renames the directory named prevName at path dirPath to newName only if newName is not already a directory.

    I've arranged my saves in folders (1 folder per save), and simply rename the folders to rename saves. A list of folder names is saved seperately in a settings file.

    Gregzo
     
  21. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    I'm considering your save solution, however I need to clarify something about your EasySave solution:

    See I have a tower defense game where I want the play to have the ability ro resume the game from exactly where he is stopped and tried another solution however it seams the I need to do a lot of modifications to my code??!!

    Like I need to serialize all my private fields and classess, I need to change my coroutine strcucture so they will be able to contiune after loading the scene (else the scene will be loaded but enemies and towers will not more only load and stop).

    So what is the required effort to integrate with your save solution, taking in consideration the following:
    1- I'm using TD game where in my Hierarchy I have spawn-Manager which should spawn the enemies from prefabs based on conditions and time periods (so the enemy will not be exist in the Hierarchy tab during design time only in run time).
    2- My code have a lot of private fileds, also many smaller classes that contain data (please see a sample of one of my many classess below) do I need to do anything or you solution can save all these information?
    3- when I load the secne will it contiune the existing coroutine so the gameplay will resume? or do I need to do something to make this happen?


    [System.Serializable]
    public class BuffStat{
    //buff doesnt stack, higher level override lowerlevel buff
    [HideInInspector] public int buffID=0;
    public float damageBuff=0.1f;
    public float cooldownBuff=0.1f;
    public float rangeBuff=0.1f;
    public float regenHP=1.0f;

    public BuffStat Clone(){
    BuffStat clone=new BuffStat();
    clone.buffID=buffID;
    clone.damageBuff=damageBuff;
    clone.cooldownBuff=cooldownBuff;
    clone.rangeBuff=rangeBuff;
    clone.regenHP=regenHP;

    return clone;
    }
    }
     
  22. tnaseem

    tnaseem

    Joined:
    Oct 23, 2009
    Posts:
    149
    Man, this thread is getting long (might I suggest creating your own forum, like some other plugin developers have? Make searching for related problems much easier). Anyway, after a cursory look through this thread, I couldn't find a solution to my issue. So, here goes...

    I'm saving/loading from the web server, with your ES2PHP.php file. All working fine to a point. I can save and load individual tagged data fine. Basically, I'm saving a whole load of data with their own unique tags (unique identifiers). I want to be able to grab this tagged data at certain points in the application I'm developing.

    However, the only way to grab this data is to download each individually, wait, and then do a ES2Load() on each in a Coroutine. But this causes delays as the data needs time to transfer from the web server, and I can't continue to the next bit until I get this data.

    What I'd prefer to do is to download the entire set of data at the start (no matter what the tags are), and do an ES2.Load("<url>?tag=<identifier>") thereafter for each element when needed. However, the system doesn't appear to allow for this (unless they all share the same tag).

    Any ideas how this can be achieved?

    Also, I noticed that the ES2.Exists() doesn't work for web based save/loads. The ES2.IsDownloadError() fails if it can't located a tagged element, which is fine, but, I'd like to use the ES2.Exists() function thereafter to check if there's any data, or if it was some other error.

    All this Error function does is to tell me that there's an error, and the GetDownloadError() returns appears to return a string. We need error codes allowing us to trap errors so we can act on them accordingly, rather than just printing some text to the console. Yes, I can change the 'echo' outputs in my PHP file to make my own errors, but the 'file doesn't exist' error is an internal error thats returned as a string. At least if the ES2.Exists() function worked in this case, it would help.

    I would also like to second the suggestion of updating your documentation which is rather lacking and needs plenty of love.

    Hope this drivel made sense.

    Cheers,
    Tarique.
     
    Last edited: Sep 7, 2012
  23. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    We haven't read from Joel for a a week or two, I hope he's just on holiday.

    @Joel I'd really find it useful if that LoadFromResources method you mentioned was rehabilitated. I'm building a web player for my project, and it'd be very convenient to load preset demos on the fly, through resources.

    Cheers,

    Gregzo
     
  24. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Hi Joel, I'm looking for the save/load solution for my project. I noticed someone mention about iCloud on Page 7 from this thread, but I want to know will Easy Save 2 going to add an iCloud feature in the future? or we need to buy another solution such as Jemast iCloud plugin? will they (other plugin) work well with Easy Save?
     
  25. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Joel?
    Are you still there? Searching...

    Four weeks since your last post, I sincerely hope support for the product isn't going to die so soon.

    Gregzo
     
  26. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi everyone,

    Apologies for the late reply. For some reason Unity stopped sending me emails when there are new replies to this thread.

    I'm going to clear my schedule for Monday so that I can spend a decent amount of time answering your questions individually. Support for ES2 is certainly alive and well, and for a quicker response you may message us direct at http://moodkie.com/contact/.

    Thanks for your patience!

    Joel
     
  27. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    thank you for the update :)
     
  28. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    I'll address feature requests in this message:

    File/folder renaming functions are high up on our To Do list.

    With regards to the web functionality, ES2.Exists will be coming, as will error codes and more useful error messages.

    We've been using the feedback over the past few months to develop ES2 and we're currently restructuring it to make it more expandable, more debuggable and easier for all of you; this is why there has been some delay to updates.

    We're also working on a brand new set of documentation which is in a similar style to the Unity documentation. To say that I'm unhappy with the current documentation would be an understatement of epic proportions!

    We've also considered the idea of having a dedicated forum for Easy Save, and although we ruled out the idea in the past we're starting to think it's actually a great idea. As it will require more resources, we're going to concentrate on getting the documentation right first, but expect it in the near future. Out of interest, has anyone got any suggestions for good forum software (preferably free or open source)? I'm thinking phpBB, and allow login with a Google or Facebook account somehow.

    With regards to iCloud, we have no intention of providing our own integration with iCloud as such as it would require Easy Save to have non-cross compatible code. However, we will be writing a guide to show you how to integrate with existing iCloud plugins as it's really not at all difficult.

    To those who have not yet had replies to their questions, you should have a response before the day is up. It's really encouraging that we've got such a loyal fan base, and the least that I can do is reward you with good customer service!

    All the best,
    Joel
     
  29. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    I forgot this line:

    "Will you come over here?"

    Nice to see you back on this thread! The one urgent issue for me is the load from resources method.

    Cheers,

    Gregzo
     
  30. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Gregzo,

    Great to see you're still keeping an eye on this thread. Thanks for your support while I've been away from this thread; it's much appreciated! I'm going to reintroduce LoadFromResources in the next update for you, though I can't guarantee when that update will be as it's going to be a big one!

    Thanks,
    Joel
     
  31. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Tarique,

    We're hoping to include the ability to save and load entire files, though I can't guarantee when we'll have this functionality in place as it's not a trivial thing to implement. For the time being, I'm afraid the only real solution is to download each piece of data separately.

    All the best,
    Joel
     
  32. tnaseem

    tnaseem

    Joined:
    Oct 23, 2009
    Posts:
    149
    Many thanks for the update, Joel. Glad to see you back :)

    In the end I continued with loading each individually and waiting in a Coroutine to display the data without interrupting the users flow. Seems to be working okay, despite a short delay in getting the data up for the user. The client hasn't complained so far, so all good for now. :)

    Will eagerly await the future updates.

    As for Forum software...

    You cant really go wrong with phpBB. It's pretty good, and has been around for about a million years, so has a great amount of support. One other one to check out would be Simple Machines Forum. I think the PlayMaker guys use that one. All much of a muchness really. The last time I used phpBB (10 years ago! Man, I feel old), I remember it was very quick to setup. So, no worries there.

    Hope this drivel helps :)

    [Edit: Just realised, I seem to sign off most of my messages with 'Hope this drivel...bla bla'. Quite irritating really, now that I've noticed it...]
     
    Last edited: Oct 1, 2012
  33. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    I'm becoming tempted to end my posts with the very same thing :D

    Thanks for the advice regarding the forum software; I think phpBB will be the way we go then!

    Cheers,
    Joel
     
  34. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Hi, I'm interested in buying EasySave do a job for a client.

    I read various reviews and documentation but cannot determine whether or not I can use EasySave for IOS and Android.
    According to your documentation online, "For security reasons, you cannot directly access save files on iOS, Android, Flash or Web Player. "
    However, on the Unity Asset store, EasySave allows save and load data to file on PC, Mac, Android, IOS and even Web Player.

    Can you tell me where I can get the latest detailed information of what platform EasySave works with.

    Thanks
     
  35. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Rocki,

    Apologies for the confusion. The text about directly accessing files should have been removed, so I'll go about doing that later.

    To clarify, Easy Save allows you to save to File and to PlayerPrefs on PC, Mac, Android and iOS. It lets you save to PlayerPrefs on the Web Player and Flash, but not to File for security reasons.

    All the best,
    Joel
     
  36. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    @rocki FYI I've been using EasySave in an iPad project for a few months now, no problem writing to the app's documents folder.

    @Joel Any ETA on that next release?

    Cheers,

    Gregzo
     
  37. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    We can't give a definite date yet as we'd rather not have to rush it. One of our priorities at the moment is designing things so that in the future we will be able to quickly and reliably update, extend and test ES2, so future updates will be much more timely.

    Thanks for your patience!
    Joel
     
  38. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Thanks Joel and Gregzo for your replies,

    Gregzo, "no problem writing to the app's documents folder." Is this using the "save to File" feature ? and can the file be saved to other places on IOS. The reason I ask is that the app needs to save meshes,bones,textures to a non-accessible location to the user.

    Joel, "The text about directly accessing files should have been removed" , does this mean that saving a file is possible but not reading the file? I'm getting lost here.

    where can I find more detailed documentation regarding where the files can be saved and read.

    Thanks.
     
  39. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Documentation for Easy Save can be found using the links HERE. It cannot currently save bones, which may make it unsuitable for your application.

    If you need to save to a non-accessible location, Easy Save can save to PlayerPrefs, which saves data to the registry. The alternative is to save to File, which by default saves to the documents folder for that app on iOS. Although this isn't easily accessible, I believe it is accessible on jail-broken phones.

    To clarify, I was saying that the text on the website was wrong. You can save and load from files on PC, Mac, iOS and Android. But you can only save to registry on Web Player and Flash.
     
  40. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    @Joel @ rocki

    Little cheap apps such as DiskAid or iExplorer allow the user to retrieve the documents folder content very easily. Since PlayerPrefs isn't suitable for large amounts of data, I'd advise saving to file with encryption.
     
  41. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Hi how do I save a generic list of custom classes eg Player in with something like

    List<Player> player = new List<Player>();
    Player p1 = new Player("dave");
    Player p2 = new Player("john");
    player.Add(p1);
    player.Add(p2);
    ES2.Save(player,"players");

    it throws not supported type exception

    thanks
     
  42. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Matt,

    I'm afraid you cannot save custom classes like that. The best thing I can do is show you an example of how you would save a custom class.

    In this example we are saving/loading a custom class called 'Item'. You can see the class definition at the bottom of the script. For a list of types which Easy Save supports, please see our Supported Types page. If there is a Unity/C#/JS type which you would like support for, get in touch and we'll add it to our To Do list.

    Here's the script: http://www.moodkie.com/easysave/SaveLoadClass.cs

    All the best,
    Joel
     
  43. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Hey Joel
    Thanks for that I will give it a go

    cheers

    Matt
     
  44. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Hi

    Also I noticed that this : ES2.Exists("myFile.txt"); always returns false even thought the file is there and loads the data successfully. I tested on player and IOS

    PHP:
    void Start()
    ES2.Save("A string""myFile.txt?tag=myString");
            
    StartCoroutine("WaitAndLoad");
            
            
        }
        
        
        
    IEnumerator WaitAndLoad(){
            yield return new 
    WaitForSeconds(2);

            print(
    ES2.Exists("myFile.txt"));
            print(
    ES2.Load<string>("myFile.txt?tag=myString"));
            
        }
     
  45. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Matt,

    Currently when saving to PlayerPrefs (which is the default save location for Easy Save), ES2.Exists("myFile.txt") will always return false. However in your case, ES2.Exists("myFile.txt?tag=myString") will return true. This is due to the way that the keys are stored in PlayerPrefs.

    This won't be the case in the next update of ES2, but for the time being you should specify a tag when using Exists() with PlayerPrefs.

    All the best,
    Joel
     
  46. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hello,

    I'm looking for a solution to encrypt all of my games data due to IOS / Android In App Purchases. So I have coins and other unlockable content. Right now I save everything to PlayerPrefs which is not good.

    I see that Easy Save provides encryption, how easy is it to use? If I buy Easy Save, should I change the location of where the data is saved to?

    What kind of encryption is used? Is it true encryption?

    Thanks,

    JL
     
  47. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hello there,

    Easy Save is as easy to use as PlayerPrefs. For example, instead of doing this for saving and loading:
    Code (csharp):
    1. PlayerPrefs.SetInt("MyInt", 123); // Save
    2. int myInt = PlayerPrefs.GetInt("MyInt"); // Load
    You could do:
    Code (csharp):
    1. ES2.Save(123, "myFile.txt?tag=myInt&encrypt=true");
    2. int myInt = ES2.Load<int>("myFile.txt?tag=myInt&encrypt=true&password=myPassword");
    This saves our data to a file named myFile.txt, with encryption, and uses a tag so that we can identify this piece of data inside our file.
    Easy Save takes care of saving the file to a safe location, but you can also tell it to save to PlayerPrefs in the Easy Save format, which saves to the registry.
    Easy Save uses AES encryption, so it's true encryption, and VERY secure.

    All the best,
    Joel
     
  48. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Thanks,

    All I see on the asset store is Easy Save, not Easy Save 2. Where is Easy Save 2?

    Thanks,

    JL
     
  49. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi JL,

    Easy Save comes with ES1 and ES2.

    All the best,
    Joel
     
  50. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Joel I hope you're joking. EasySave is way easier than PlayerPrefs, especially if you need to save more complex stuff ;)