Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Easy Save - The Complete Save & Load Asset for Unity

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

  1. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi Mr. Jingle,

    Could you send me the code you are using to moodkie.com/contact so I can have a go at troubleshooting the error.

    Thanks,
    Joel
     
    Last edited: Jun 1, 2017
  2. JoelAtMoodkie

    JoelAtMoodkie

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

    There are a couple of errors with your load script. Firstly, it should be LoadArray<Transform>. Secondly, you need to use the self-assigning functions to load Transforms in Easy Save 2. We're looking at including the loading of Transforms into an array like ES1, but because you cannot have a Transform without a GameObject to attach it to, it often confuses people.
     
  3. matis1989

    matis1989

    Joined:
    Mar 23, 2011
    Posts:
    162
    Thank you for answer, but I dont understand ES2 at all:)
    Now I have:
    Code (csharp):
    1. grass_prefab = ES2.LoadArray <Transform> ("Save.txt?tag=grass", Transform);
    But I have some more errors, Iam doing something very wrong:)
     
  4. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    The second parameter for the LoadArray function should be an array containing the Transforms you want to apply the saved data to, and you should remove the "grass_prefab =" part completely.

    If you can wait until Monday, I'll release an update which will allow you to use the code:
    Code (csharp):
    1. grass_prefab = ES2.LoadArray <Transform> ("Save.txt?tag=grass");
    You're not the first person who has found this confusing, so I'm sure this update will be welcomed :)
     
  5. OlivierT

    OlivierT

    Joined:
    May 10, 2012
    Posts:
    3
    Hi there,
    I just bought ES2 yesterday and am already glad I did, looks both powerful and easy to use.
    I have a very basic problem though, chances are it's a very obvious mistake from me but I'm not seing what is wrong. This code works fine:
    int SaveTest1 = 42;
    int SaveTest2 = 666;

    ES2.Save(SaveTest1, "SaveFile.test?savelocation=file&tag=Test1");
    ES2.Save(SaveTest2, "SaveFile.test?savelocation=file&tag=Test2");
    int LoadTest1 = ES2.Load<int>("SaveFile.test?savelocation=file&tag=Test1");
    int LoadTest2 = ES2.Load<int>("SaveFile.test?savelocation=file&tag=Test2");

    But this one, which should do exactly the same to my understanding does not:
    int SaveTest1 = 42;
    int SaveTest2 = 666;

    ES2Settings settings = new ES2Settings();
    settings.saveLocation = ES2.SaveLocation.File;
    settings.tag = "Test1";
    ES2.Save(SaveTest1, "SaveFile.test", settings);
    settings.tag = "Test2";
    ES2.Save(SaveTest2, "SaveFile.test", settings);

    settings.tag = "Test1";
    int LoadTest1 = ES2.Load<int>("SaveFile.test", settings);
    settings.tag = "Test2";
    int LoadTest2 = ES2.Load<int>("SaveFile.test", settings);
    In the second example both LoadTest1 and LoadTest2 are set at 666.

    It's not blocking me since I will just use the first method, but I would be interested to understand what I am doing wrong in the second one.
    Thanks!
     
  6. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi Olivier,

    Don't worry, it's not your mistake! There was a small bug where ES2 wasn't giving ES2Settings priority over the parameters, and thus was giving the default tag priority over the ES2Settings tag.

    This bug will be fixed in our update on Monday, so you'll be able to use whichever method you want :)

    All the best,
    Joel
     
  7. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    I've just submitted the update to allow for loading of Components/Transforms without using the self-assigning functions and it should be available today or Monday. Because Unity doesn't let you assign directly to a GameObject's Transform, you will have to do something like this:
    Code (csharp):
    1. // Load our Transforms
    2. Transform[] loadedTransforms = ES2.LoadArray <Transform> ("Save.txt?tag=grass");
    3. // Assign the elements of these loaded Transforms to our own Transforms.
    4. // For each Transform in grass_prefab
    5. for(int i=0; i<grass_prefab.Length; i++)
    6. {
    7.      grass_prefab[i].position = loadedTransforms[i].position;
    8.      grass_prefab[i].rotation = loadedTransforms[i].rotation;
    9.      grass_prefab[i].localScale = loadedTransforms[i].localScale;
    10.      grass_prefab[i].tag = loadedTransforms[i].tag;
    11. }
    12.  
    All the best,
    Joel
     
  8. kays

    kays

    Joined:
    Apr 10, 2012
    Posts:
    2
    Hello.

    I've parchased ES2,and really appreciate this awesome work.

    I would like to ask about save settings.

    I use ES2 with settings below on Unity Android.

    settings.saveLocation = ES2.SaveLocation.PlayerPrefs;

    When uninstall my app , saved data still remains.
    Though,This is not I intended.

    Is there a way to delete all the saved data when uninstalling?
    Or Is there to know the saved location to delete manually.

    Thanks in advance.
     
  9. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    I got a crash error when running encrypt() in iOS.
    i added the try-catch block to the encrypt function, found out the following log when pdb.GetBytes(32) is called:
    Code (csharp):
    1.  
    2. icall.c:1331:
    3. System.NullReferenceException: A null value was found where an object instance was required.
    4.   at System.Security.Cryptography.HMAC.Initialize () [0x00000] in <filename unknown>:0
    5.   at System.Security.Cryptography.HMAC.HashCore (System.Byte[] rgb, Int32 ib, Int32 cb) [0x00000] in <filename unknown>:0
    6.   at System.Security.Cryptography.HashAlgorithm.ComputeHash (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
    7.   at System.Security.Cryptography.HashAlgorithm.ComputeHash (System.Byte[] buffer) [0x00000] in <filename unknown>:0
    8.   at System.Security.Cryptography.Rfc2898DeriveBytes.F (System.Byte[] s, Int32 c, Int32 i) [0x00000] in <filename unknown>:0
    9.   at System.Security.Cryptography.Rfc2898DeriveBytes.GetBytes (Int32 cb) [0x00000] in <filename unknown>:0
    10.   at EasySave.encrypt (System.Byte[] param, System.String password) [0x00019] in xxxxxxxxxxxxxxx/Assets/Plugins/Easy Save/Easy Save 1/EasySave.cs:3502
    it works in the editor. it also works if stripping level of iOS setting is "disabled".
    if iOS Stripping level is not "disabled", it will crash even i include the following link.xml to the project:

    Code (csharp):
    1. <linker>
    2.     <assembly fullname="mscorlib">
    3.         <type fullname="System.Security.Cryptography" preseve="all"/>
    4.         <type fullname="System.Security.Cryptography.CipherMode" preseve="all"/>
    5.         <type fullname="System.Security.Cryptography.CryptoConfig" preseve="all"/>
    6.         <type fullname="System.Security.Cryptography.CryptoStream" preseve="all"/>
    7.         <type fullname="System.Security.Cryptography.CryptoStreamMode" preseve="all"/>
    8.         <type fullname="System.Security.Cryptography.CryptographicException" preseve="all"/>
    9.         <type fullname="System.Security.Cryptography.CryptographicUnexpectedOperationException" preseve="all"/>
    10.         <type fullname="System.Security.Cryptography.CspParameters" preseve="all"/>
    11.         <type fullname="System.Security.Cryptography.DeriveBytes" preseve="all"/>
    12.         <type fullname="System.Security.Cryptography.HashAlgorithm" preseve="all"/>
    13.         <type fullname="System.Security.Cryptography.ICryptoTransform" preseve="all"/>
    14.         <type fullname="System.Security.Cryptography.KeySizes" preseve="all"/>
    15.         <type fullname="System.Security.Cryptography.PaddingMode" preseve="all"/>
    16.         <type fullname="System.Security.Cryptography.PasswordDeriveBytes" preseve="all"/>
    17.         <type fullname="System.Security.Cryptography.Rijndael" preseve="all"/>
    18.         <type fullname="System.Security.Cryptography.SHA1" preseve="all"/>
    19.         <type fullname="System.Security.Cryptography.SHA1CryptoServiceProvider" preseve="all"/>
    20.         <type fullname="System.Security.Cryptography.SymmetricAlgorithm" preseve="all"/>
    21.     </assembly>
    22. </linker>
    Did i miss anything? Thanks.
     
  10. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi Kays,
    From what I've read, PlayerPrefs behaves differently on different phones. This thread says that PlayerPrefs are stored in Shared Preferences. It might be worth contacting Unity about this as we have no control over how PlayerPrefs work.
    All the best,
    Joel
     
  11. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi akwok,

    I'm afraid that enabling stripping removes the libraries required for Easy Save 1 encryption. We've tried creating link.xml files ourselves using the specification presented by Unity but so far have had no luck at getting it to work either.

    Easy Save 2 uses an external library for encryption, so if you need to use stripping, it'll be worth giving that a try. I've not currently got access to a copy of Unity iOS Pro so I can't try this out myself at the moment.

    Regards,
    Joel
     
  12. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    Thanks for the answer. Is Easy Save 2 stable enough to be used?
     
  13. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Yes, it's very stable (with thanks to all of the people who have been helping with testing over the past few months).

    All we're working on now is improving the documentation, and then it will be out of beta. After that we'll be working on adding more of the features that everyone has suggested.
     
  14. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    Nice to know! If i code ES2.Save("test", "save.xml"); Where will the save.xml be saved in the iphone?
     
  15. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    By default it will be saved to PlayerPrefs, so it's not technically saved to a file but saved in the registry. If saving using 'File' as the save location, it'll be saved at the path specified by Application.persistentDataPath.

    If you put Debug.Log(Application.persistentDataPath); in your code and build it to your iPhone, it'll output the save location for your device to the console in XCode.
     
  16. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31

    Joel, I am using ES2, iOS, stripping bytecode, it still gives error:

    Code (csharp):
    1. System.NullReferenceException: A null value was found where an object instance was required.
    2.   at System.Security.Cryptography.PasswordDeriveBytes.Reset () [0x00000] in <filename unknown>:0
    3.   at System.Security.Cryptography.PasswordDeriveBytes.GetBytes (Int32 cb) [0x00000] in <filename unknown>:0
    4.   at Elixis.AESEncryptor.Decrypt (System.Byte[] data) [0x00000] in <filename unknown>:0
    5.   at MoodkieReader.GetDecryptedBytes () [0x00000] in <filename unknown>:0
    6.   at MoodkieReader.ReadEncrypted[String] () [0x00000] in <filename unknown>:0
    7.   at MoodkieReader.Read[String] () [0x00000] in <filename unknown>:0
    8.   at MoodkieLoad.Load[String] (.ES2Settings settings) [0x00000] in <filename unknown>:0
    9.   at ES2.Load[String] (System.String identifier, .ES2Settings settings) [0x00000] in <filename unknown>:0
    10.   at XMLSerializer.Deserialize[SerializableDictionary`2] (System.String fileName) [0x00000] in <filename unknown>:0
    any clue? Thanks~
     
  17. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi Akwok,

    Could you send me the code you are using at moodkie.com/contact. From this error it looks like you are using a null value as a parameter somewhere.
     
    Last edited: Jun 1, 2017
  18. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    Sent your the email, thanks.
     
  19. kamakura1192

    kamakura1192

    Joined:
    Apr 1, 2012
    Posts:
    4
    My code is:
    Code (csharp):
    1.  
    2. function Start () {
    3.     var loadPath : String = "ObjectName";
    4.  
    5.     ES2.Save(gameObject.name, loadPath);
    6.     if(ES2.Exists(loadPath)) {
    7.         gameObject.name = ES2.Load.<String>(loadPath);
    8.     }
    9. }
    10.  
    I get errors using the ES2 in webplayer.

    What am I doing wrong?
    (I'm sorry. This document has been translated in Google Translate. . .)
     
  20. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi kamakura,

    The code you have posted is working fine at our end. Please make sure you have updated Easy Save and are using the latest version of the Unity engine.

    If this does not fix your problems, please let us know what settings you have changed and if you have modified Easy Save in any way. It might be easier for you to email me directly at moodkie.com/contact. If your project is below 10mb when compressed, you might also want to send this to me if you're happy to do so.

    Joel
     
    Last edited: Jun 1, 2017
  21. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Also try deleting Easy Save and reinstalling it from the Asset Store.
     
  22. OlivierT

    OlivierT

    Joined:
    May 10, 2012
    Posts:
    3
    Hi there,
    just a suggestion, but it would be nice for you to have a forum on your website to talk about everything EasySave. Doing so in a single forum thread feels a bit awkward.
     
    Last edited: Jun 6, 2012
  23. nicunity

    nicunity

    Joined:
    Feb 26, 2012
    Posts:
    52
    Hi,

    Does this work with unity 3.4?
     
  24. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi OlivierT. Sorry for the late reply; I didn't get an email saying that there were new posts in this thread.

    We've used dedicated forums for other products in the past, but we felt the time spent maintaining it was better spent on other things. Maybe when we have more time we will look into this.
     
  25. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi nicunity,

    I can see no reason why not, though I cannot guarantee it. Future updates of Easy Save will certainly not work as they will support saving Audio data, which if I remember rightly was only accessible in 3.5 onwards.
     
  26. OlivierT

    OlivierT

    Joined:
    May 10, 2012
    Posts:
    3
    No problem, I was not mentionning it for a reason of reply time. Rather because I had some ideas/suggestions I felt could be intersesting for EasySave, but it feels unconfortable to begin and follow a discussion about that in the middle of this thread (at least to me :p )
     
  27. kenshako

    kenshako

    Joined:
    Jun 19, 2012
    Posts:
    5
    Please help!
    EasySave2 is good plugs. I'm a beginner to use it.

    I tried to save a Array to file, but it's failed. this is my code ( javascript code ):

    var pointArr : Vector3[];
    pointArr = new Vector3[4];
    pointArr[0] = Vector3(0,0,6);
    pointArr[1] = Vector3(6,0,6);
    pointArr[2] = Vector3(0,0,0);
    pointArr[3] = Vector3(6,0,0);
    ES2.Save ( pointArr, "myDataFile.txt"); // this is error highlight in unity

    Console error:
    ES2TypeNotSupportedException: Easy Save Type Not Supported Exception: Easy Save does not support saving this type. If you are trying to load a collection such as a Dictionary, use the collection classes (for example, LoadDictionary<>()).
    MoodkieWriter.Write (System.Object param)
     
  28. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi kenshako,

    We've tried your code at our end and we are not getting any errors. Please ensure that you are using the latest version of Unity and Easy Save. Also ensure that there are no errors earlier in your code as this can cause later pieces of code to fail. For reference, here is the code we used to test that it is working:

    Code (csharp):
    1. #pragma strict
    2.  
    3. function Start ()
    4. {
    5.     var pointArr : Vector3[];
    6.     pointArr = new Vector3[4];
    7.     pointArr[0] = Vector3(0,0,6);
    8.     pointArr[1] = Vector3(6,0,6);
    9.     pointArr[2] = Vector3(0,0,0);
    10.     pointArr[3] = Vector3(6,0,0);
    11.     ES2.Save ( pointArr, "myDataFile.txt");
    12.    
    13.     // This loads our saved data and outputs it to console.
    14.     var newPointArr : Vector3[] = ES2.LoadArray.<Vector3>("myDataFile.txt");
    15.     for(var i : int =0; i<newPointArr.Length; i++)
    16.         Debug.Log(pointArr[i]);
    17. }
     
  29. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    658
    Hi,

    Can someone tell me where is easysave saving by default on a MAC ?
    Also, joeltebbett, the contact form on the moodkie page doens't work.
    What's your email ?
     
  30. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi BigB,
    We're looking at getting the contact form fixed today.

    By default Easy Save saves to PlayerPrefs, which is technically a registry.
    If saving to File, the default path is /Users/YourUserName/Library/Caches/Moodkie/Easy Save 2.

    All the best,
    Joel
     
    Last edited: Jun 1, 2017
  31. kenshako

    kenshako

    Joined:
    Jun 19, 2012
    Posts:
    5
    that's right, it seem that my ES2 version made a mistake, that code has passed in my testing.
    Thank you so much!
     
  32. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    If there is a class Unit.cs that is inherited from MonoBehaviour, it contains some public properties, such as hp, move, damage etc. Is it possible to have something like ES2.Save( unit , "save.txt" ); and ES2.Load<Unit>( "save.txt", unit ); ??
     
  33. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi yuewah,

    You can create your own functions to save and load your own classes. The best way to do this would be to add Save Load functions to the Unit class. Here's an example I've created for you:

    Code (csharp):
    1. public class Unit : MonoBehaviour
    2. {
    3.     public int id; // This allows us to uniquely identify this Unit.
    4.     public string path = "myFile.txt"; // Where we want to save our data.
    5.    
    6.     public int hp;
    7.     public int move;
    8.     public int damage;
    9.    
    10.     // This handles the saving of an item.
    11.     public void Save()
    12.     {
    13.         string pathWithID = path+"?tag="+id; // Create our path.
    14.        
    15.         // Now we save our variables.
    16.         ES2.Save(hp, pathWithID+"hp");
    17.         ES2.Save(hp, pathWithID+"move");
    18.         ES2.Save(hp, pathWithID+"damage");
    19.     }
    20.    
    21.     // This handles the loading of an item.
    22.     public void Load()
    23.     {
    24.         string pathWithID = path+"?tag="+id; // Create our path.
    25.        
    26.         // If there's no data to load, do nothing.
    27.         if(!ES2.Exists(pathWithID+"hp"))
    28.             return;
    29.        
    30.         // Now we load our variables.
    31.         hp = ES2.Load<int>(pathWithID+"hp");
    32.         move = ES2.Load<int>(pathWithID+"move");
    33.         damage = ES2.Load<int>(pathWithID+"damage");
    34.     }
    35. }
     
  34. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    Dictionary<,> is support but it cannot contains duplicate Key, So can you support List< KeyValuePair < string, string > > ??
     
  35. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    We've put support for List<KeyValuePair<TKey, TValue>> on our To Do list.
     
  36. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    ES2.Save(go1.name, "save.txt");
    ES2.Save(go2.name, "save.txt");
    ES2.Save(go3.name, "save.txt");

    Is it have 3 write access to file ? if yes, it is possible to batch write to file ?
     
  37. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    You can save multiple things to one file using tags. For example:
    Code (csharp):
    1. ES2.Save(go1.name, "save.txt?tag=nameOne");
    2. ES2.Save(go2.name, "save.txt?tag=nameTwo");
    3. ES2.Save(go3.name, "save.txt?tag=nameThree");
    And load using:

    Code (csharp):
    1. string nameOne = ES2.Load<string>("save.txt?tag=nameOne");
    2. string nameTwo = ES2.Load<string>("save.txt?tag=nameTwo");
    3. string nameThree = ES2.Load<string>("save.txt?tag=nameThree");
     
  38. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    sorry, what I concern is the performance of the read / write operation. As I have many Save operations to do.
     
  39. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    The overhead actually isn't very high. However, if you want to save a bit of performance then put all of the objects into an array and save that.
     
  40. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    apart from performance, I think it will be easy to have corrupted data file. How to avoid this ?

    e.g.
    ES2.Save(go1.name, "save.txt?tag=nameOne"); // succeed
    ES2.Save(go2.name, "save.txt?tag=nameTwo"); // succeed
    ES2.Save(go3.name, "save.txt?tag=nameThree"); // fail

    go1.name = ES2.Load<string>("save.txt?tag=nameOne"); // succeed
    go2.name = ES2.Load<string>("save.txt?tag=nameTwo"); // succeed
    go3.name = ES2.Load<string>("save.txt?tag=nameThree"); // fail
     
  41. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    You may use a try/catch block to catch a number of exceptions. A list of these exceptions can be found at http://www.moodkie.com/easysave/Exceptions.php. However, we have not had a single case of data corruption in any version of Easy Save; we estimate that we've made in excess of 250,000 Save calls with Easy Save in the past 6 months alone.
     
  42. yuewah

    yuewah

    Joined:
    Sep 21, 2009
    Posts:
    98
    is it possible to save as human readable text format, e.g. XML or JSON ?
     
  43. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Has anyone tried using this in conjunction with uScript?

    Also, I'm curious whether Easy Save supports GameObject variables or lists of GameObjects.
     
  44. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    This is on our To Do list, but we've not currently had much demand for it.
     
  45. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    You cannot save entire GameObjects as such. However, you can save individual components and assign them to GameObjects. For a list of supported types, please see http://www.moodkie.com/easysave/SupportedTypes.php.
     
  46. kbomb

    kbomb

    Joined:
    Jun 26, 2012
    Posts:
    3
    Hello ,

    is it possible to use your plug in for a tower defense games ?
     
  47. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi kbomb,

    Any game should be possible with Easy Save, but how easy it is to implement depends on how you have implemented your game. The best way to find this out is to check out the Coding Reference and Beginners Guide to see if it provides the functionality you need.

    Regards,
    Joel
     
  48. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    314
    Is the basic concept of EasySave that if you want to store, say, playerHealth (an int), and then you also have a variable called player name, each of these has to have it's own separate file? So there can't be one large file containing lots of different data types?

    I was really hoping for a solution that could help keep the save player data clean and organized when dealing with large amounts of data that must be saved. But either way this is still very good and definitely easy to use once some Documentation reading and experimenting has been done.

    In the future it would be awesome if you could add a way to make some sort of batch file or something similar that contains keys for identifying different parts of the file for saving to and loading from so a bunch of single files aren't needed.
     
    Last edited: Jun 29, 2012
  49. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    567
    Hi disastercake,

    Luckily we already support this functionality with the use of tags, which is a type of parameter. For example, we could achieve what you want by doing the following:
    Code (csharp):
    1. ES2.Save(playerHealth, "myFile.txt?tag=playerHealth");
    2. ES2.Save(playerName, "myFile.txt?tag=playerName");
    and then to load:
    Code (csharp):
    1. if(ES2.Exists("myFile.txt"))
    2.    playerHealth = ES2.Load<int>("myFile.txt?tag=playerHealth");
    3.    playerName = ES2.Load<string>("myFile.txt?tag=playerName");
    I'm working on an FAQ section at the moment which will make Easy Save much easier to learn. For the time being, you can find more information on parameters HERE.

    All the best,
    Joel
     
  50. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    314
    Very cool! =D

    Thank you for the quick response. I will be testing this out later.

    So if you append to a tag you add an extra field to it that you can pull from, or does it just combine the 2 values?
     
unityunity