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
    Hi there,

    If it was still gathering references then it would stop Unity from entering playmode until it had finished, so it looks like the issue might be that the window isn't being closed by Unity rather because it's still gathering references. We'll actually be removing this in the next update which we're just waiting for Unity to approve. In the meantime I'll PM the update to you.

    With regards to the thread you've mentioned, disabling the domain reload would prevent the following things from happening when you enter playmode:

    • References from being automatically gathered (if enabled)
    • Assembly definition files from being managed (which allows reflection to know what assemblies to look in)
    However, these things also happen when you save the scene and when you build, so as long as you save your scene occasionally I don't foresee any issues.

    All the best,
    Joel
     
    Last edited: May 17, 2020
    KarlKarl2000 likes this.
  2. K0ST4S

    K0ST4S

    Joined:
    Feb 2, 2017
    Posts:
    35
    Global References in a ScriptableObject is much better. However, the updated version crashes Unity when Refreshing references:( I suspect it's because I have Missing reference field somewhere in the scene
     
  3. JoelAtMoodkie

    JoelAtMoodkie

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

    Could you confirm you're using the very latest version from the Asset Store? We are aware of an issue like this in the previous version, but not the latest version.

    If updating doesn't solve your issue, please could you private message me a project which replicates it?

    All the best,
    Joel
     
  4. zetaxbr

    zetaxbr

    Joined:
    May 17, 2016
    Posts:
    22
    Hello Joel,

    First of all thank you very much for your awesome tool. I'm using ES2 with Playmaker to store the data of my game. I'm trying use some web load/save but I just have success with the "Upload String Action" (stored the variable and savefile on MY SQL 100%), but when I try use the "Download String Action" an error on Unity Console appears:
    "ArgumentNullException: Value cannot be null
    Parameter name: _unity_self"
    Playmaker State doesn't advance also on Playmaker FSM flow (no error code either).

    Any idea what i'm doing wrong?

    Last question: Can I store variables and values editing directly in the SQL Database? I want to my game checks the client version with the download site version online (to keep updated) I wanna to add a string variable on SQL that I can edit to compare with the string on client data so the client know when a new version will be available.
     
    Last edited: May 26, 2020
  5. JoelAtMoodkie

    JoelAtMoodkie

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

    Firstly, if you're using ES2 I recommend updating from the Asset Store and then go to Plugins > Easy Save 3 > Legacy, and double-click Easy Save 2.unitypackage to ensure that Easy Save 2 is up to date

    If that doesn't resolve the issue, please could you private message me a project which replicates it?

    In Easy Save 2 the 'Upload String' action uploads individual values. So you can use this to upload your string variable, and then use 'Download String' action to download it.

    Note that Easy Save 2 should only be used for projects which have already been released with Easy Save 2. For all new projects you should use Easy Save 3.

    All the best,
    Joel
     
  6. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    466
    Hello,
    Regarding this documentation for iOS and encryption declaration.
    Assuming we use the most basic AES encryption in Easy Save 3, I suppose it falls into Category 5 Part 2 of the following information? Is there any information that must be added on the App's store page details?
     
  7. JoelAtMoodkie

    JoelAtMoodkie

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

    Unfortunately we are not able to provide more information that what is already mentioned in the documentation. My understanding is that it does fall under Category 5 Part 2. As far as I'm aware you don't need to put anything on the App Store details page. However, I am not a legal adviser so don't take this as legal advice :)

    All the best,
    Joel
     
  8. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    466
    Me neither! :D
    I would guess that if it had been a problem, several users would have already reported on it regarding those legal issues.
    I suppose it might be safe to assume that a simple gaming app that just encrypts the player's data locally, on the device, could pass under category 5 part 2. Big IF.
    Logically, Apple and Google would warn me if there was a problem here.
     
  9. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    466
    Now, FWIW, if we want to delve deeper into this (annoying) topic...
    The description of cat5pt2 seems to include most cases of minimal use of encryption for user data but what do I know?
    It's a fairly long paragraph, very technical and elusive.
    Here are some threads that mostly help aggravating my concerns if anything else...
    https://stackoverflow.com/questions/14170121/aes-256-encryption-apple-itunes-export-restrictions
    https://stackoverflow.com/questions/2135081/does-my-application-contain-encryption
    https://softwareengineering.stackex...approval-to-submit-an-ios-app-that-uses-encry
    https://cryptomator.org/blog/2016/06/16/indepth-french-app-store/
    I have absolutely no time to waste on complicated bureaucracy that would have me waiting for WEEKS before being able to get anywhere.
    It's a very casual little game being made here and I just want to make sure a user isn't going to fiddle with the data file that stores everything including local achievements, virtual money, bought stuff and validated IAPs.
    I might be able to quickly come up with a dirty and old school cypher but I suppose that when Google/Apple will check the es3 file, they might spot the garbled mess and assume some encryption is going on.
    And it would certainly fall in the "proprietary encryption" that has obviously nothing to do "accepted as standard by international standard bodies".
    So the real question is:

    Is it safe not to use encryption (AES) for mundane player data that must, nevertheless, not be tinkered with?

    An iOS bundle is signed but how protected is the plist contained within?
    Although editing such a file is not accessible to your average Joe, it's not exactly impossible either (1, 2), but these are old resources.
     
  10. JoelAtMoodkie

    JoelAtMoodkie

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

    It's not possible for me to say how secure your data would be, it should be said that on iOS it would be possible to modify the data using a jailbroken device.

    All the best,
    Joel
     
  11. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    466
    So no AES encryption would still cover like 99% of users, right?
     
  12. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    It would cover iOS users who don't have jailbroken, but it's not possible for me to say what percentage of your users that would be :)
     
  13. nitoh

    nitoh

    Joined:
    Mar 20, 2014
    Posts:
    30
    Hi,

    I try to improve my saving performance, with the using ofcache saving solution.

    But with ES3.StoreCachedFile() and ES3.Location.Cache; I get a non contatined definition error

    What am I doing wrong?
     
  14. JoelAtMoodkie

    JoelAtMoodkie

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

    I've never heard of a non contained definition error before. Please could you private message me a project which replicates this?

    Also just to check, are you using the latest version from the Asset Store? This was added recently.

    All the best,
    Joel
     
  15. nitoh

    nitoh

    Joined:
    Mar 20, 2014
    Posts:
    30
    Upgrading the asset, is solved the problem. Thank you.
     
  16. FerakIII

    FerakIII

    Joined:
    Aug 15, 2013
    Posts:
    5
    I'm confused about when to save, if my game is both ios and PC targeted do I need to save on both onApplicationQuit and onApplicationPause? Or just onApplicationPause? If it needs to be both, then does AutoSave support both?
     
  17. JoelAtMoodkie

    JoelAtMoodkie

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

    On mobile, Auto Save will automatically save using OnApplicationPause instead of OnApplicationQuit, so you only need to select OnApplicationQuit.

    All the best,
    Joel
     
  18. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Hi~ Joel~ Saving and loading GameObjects without code, but it seems when I need to load some enemies those are already died . It's mean i just need to save the gameobject, or I still need to save the healthPoint or animator state?
     
  19. JoelAtMoodkie

    JoelAtMoodkie

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

    I'm afraid I'm having trouble understanding what you're saying. Please could you clarify?

    All the best,
    Joel
     
  20. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    I'm sorry I didn't explain it clearly. I would like to consult, if there are multiple enemies need to save their status, is use playmaker function, like load all or save all , it will the best way?
     
  21. JoelAtMoodkie

    JoelAtMoodkie

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

    If their status is stored as PlayMaker variables then this would be the easiest way. Alternatively you could use the Save and Load actions and save each one individually.

    All the best,
    Joel
     
    verteom likes this.
  22. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Thanks a lot~~
     
  23. warapuri

    warapuri

    Joined:
    Nov 7, 2016
    Posts:
    10
    Hi Joel,

    Easy Save is wonderful asset can serialize even GameObject has children.
    I'd like to serialize/deserialize user customized GameObject in runtime.
    I wonder ES3 is perfect for me.

    It seems that document site says "Rigidbody" isn't included in supported types.
    https://docs.moodkie.com/easy-save-3/es3-guides/es3-supported-types/

    Can we manually add it by own?
    Are there any issue for adding "Rigidbody" in supported types?
     
  24. JoelAtMoodkie

    JoelAtMoodkie

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

    I'll add explicit support for Rigidbody in the next update. In the meantime you can add support for it by going to Window > Easy Save 3 > Types, search in 'Rigidbody', and select the fields which you want to be serialised from there.

    All the best,
    Joel
     
  25. warapuri

    warapuri

    Joined:
    Nov 7, 2016
    Posts:
    10
    Thanks!
    I'll wait for that.
     
  26. Plaximo

    Plaximo

    Joined:
    Oct 26, 2016
    Posts:
    8
    Hi,

    I just updated to the newest version, and I faced some problems inside the ES3ReferenceMgrBase Class. In the newest version the code to get the current ES3ReferenceMgrBase changed from:

    Code (CSharp):
    1. public static ES3ReferenceMgrBase Current
    2.         {
    3.             get
    4.             {
    5.                 if (_current == null) {
    6.                     var mgrs = UnityEngine.Object.FindObjectsOfType<ES3ReferenceMgrBase>();
    7.                     if (mgrs.Length == 1)
    8.                         _current = mgrs[0];
    9.                     else if (mgrs.Length > 1)
    10.                         throw new InvalidOperationException("There is more than one ES3ReferenceMgr in this scene, but there must only be one.");
    11.                 }
    12.             }
    13.         }
    to:

    Code (CSharp):
    1.  
    2. get
    3.             {
    4.                 // If the reference manager hasn't been assigned, or we've got a reference to a manager in a different scene which isn't marked as DontDestroyOnLoad, look for this scene's manager.
    5.                 if (_current == null || (_current.gameObject.scene.buildIndex != -1 && _current.gameObject.scene != SceneManager.GetActiveScene()))
    6.                 {
    7.                     var scene = SceneManager.GetActiveScene();
    8.  
    9.                     var roots = scene.GetRootGameObjects();
    10.  
    11.                     // First, look for Easy Save 3 Manager in the top-level.
    12.                     foreach (var root in roots)
    13.                         if (root.name == "Easy Save 3 Manager")
    14.                             return _current = root.GetComponent<ES3ReferenceMgr>();
    15.  
    16.                     // If the user has moved or renamed the Easy Save 3 Manager, we need to perform a deep search.
    17.                     foreach (var root in roots)
    18.                         if ((_current = root.GetComponentInChildren<ES3ReferenceMgr>()) != null)
    19.                             return _current;
    20.                 }
    21.                 return _current;
    22.             }
    23.  
    24.  
    So it seems that the new implementation is searching only inside the active scene. I fixed it by placing the old implementation on the end of the new implementation.

    Thanks
     
  27. JoelAtMoodkie

    JoelAtMoodkie

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

    This is intended in order to ensure that it works with multiple and additive scenes.

    All the best,
    Joel
     
    Plaximo likes this.
  28. Razputin

    Razputin

    Joined:
    Mar 31, 2013
    Posts:
    356
    Can ES3 Spreadsheets be loaded from Resources and how would one do that?
    I am using them for multiple languages atm.

    Code (CSharp):
    1.  
    2. public enum Lang { ENG, ESP, RUS, CHN, JPN, ITL, BRZ, GER, FRN};
    3. public class PlayerSaveLoad : MonoBehaviour
    4. {
    5.  
    6.     [Header("Dialog")]
    7.     public Lang language;
    8.     private ES3Spreadsheet generalDialog;
    9.     public List<string> dialogList = new List<string>();
    10.  
    11.     private void Start()
    12.     {
    13.         //foreach (Person p in FindObjectsOfType<Person>())
    14.         //{
    15.         //   CharacterSetup(p);
    16.         //}
    17.         CharacterSetup(null);
    18.     }
    19.  
    20.     private void CharacterSetup(Person p)
    21.     {
    22.         generalDialog = new ES3Spreadsheet();
    23.         generalDialog.Load("E:/Farming Sim/Assets/Rabbot.csv"); //I WANT TO LOAD FROM RESOURCES HERE.
    24.  
    25.  
    26.         int cIndex = 0;
    27.  
    28.         for(int c = 0; c < generalDialog.ColumnCount; c++)
    29.         {
    30.             if(generalDialog.GetCell<string>(c, 0) == language.ToString())
    31.             {
    32.                 break;
    33.             }
    34.             cIndex++;
    35.         }
    36.  
    37.         for (int i = 1; i < generalDialog.RowCount; i++)
    38.         {
    39.             dialogList.Add(generalDialog.GetCell<string>(cIndex, i));
    40.         }
    41.     }
    42. }
    43.  
    Thanks!

    Here is what the test .csv looks like in case you were wondering too,

    ENG,ESP,RUS,CHN,JPN,ITL,BRZ,GER,FRN,
    ENGLISH,SPANISH,RUSSIAN,CHINESE,JAPANESE,ITALIAN,BRAZILIAN,GERMAN,FRENCH,
    1,2,3,4,5,6,7,8,9,
    A,B,C,D,E,F,G,H,I,
     
    Last edited: Aug 7, 2020
  29. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
  30. K0ST4S

    K0ST4S

    Joined:
    Feb 2, 2017
    Posts:
    35
    Thank you. The _current reference is being set back to null for some reason in v3.3.1f9.
     
    Plaximo likes this.
  31. JoelAtMoodkie

    JoelAtMoodkie

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

    I've had no other reports of this and don't seem to be seeing this at my end. Please could you private message me a basic project and instructions which replicate this so I can see what is happening at my end?

    All the best,
    Joel
     
  32. Akib1314

    Akib1314

    Joined:
    Jul 12, 2017
    Posts:
    4
    Hi joel,

    For cloud save, how to check the username unique or not? How to reset the password?
     
  33. JoelAtMoodkie

    JoelAtMoodkie

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

    If you want to check whether there is data stored on the server with a given username, you can simply use ES3Cloud.DownloadFilenames, providing the username as the parameter.

    However, Easy Save is not a login system, so if you want the ability to manage usernames and passwords you would need to use a login system to do this.

    All the best,
    Joel
     
    Akib1314 likes this.
  34. Akib1314

    Akib1314

    Joined:
    Jul 12, 2017
    Posts:
    4
    Hi joel,
    Thanks for your reply. I need another suggestion.

    " How to read specific data from cloud file. not whole file. what should i do."
     
  35. JoelAtMoodkie

    JoelAtMoodkie

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

    Cloud storage is file storage, so it's not possible to load an individual piece of data from the file without downloading the entire file. The alternative is to break it down into multiple files, rather than one large file.

    All the best,
    Joel
     
    Akib1314 likes this.
  36. Akib1314

    Akib1314

    Joined:
    Jul 12, 2017
    Posts:
    4
    Hi joel,
    Thanks for your quick reply.

    guids says that,
    You can synchronize a local file with the server using the ES3Cloud.Sync method:

    • If the local file is newer than the file on the server, or no file exists on the server:
      • The file on the server will be overwritten with the local file.
    • If the file on the server is newer than the local file, or no file exists locally:
      • The local file will be overwritten with the file on the server.

    i have question,
    What is the method of checking whether a file is new or not, by date or data or others. If I reinstall my game and I have no internet. Then I save the data locally. Is it newer than a cloud file? Will this file replace the cloud file if I have an internet connection?
     
  37. JoelAtMoodkie

    JoelAtMoodkie

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

    We look at the timestamp of the local file and compare this to the timestamp of the data stored in the cloud.

    This will replace the file in the cloud because it is a newer file. If this is not the behaviour you want then I recommend using ES3Cloud.UploadFile instead, and manually manage it yourself.

    All the best,
    Joel
     
  38. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @JoelAtMoodkie ,

    Hi there, just exploring just what ES3 can do in terms of saving various instantiated versions of a prefab in scene.

    Let's say each instantiated version of the Prefab, let's say A, B and C, each contain a component/monobehaviour containing a field instantiating a version of the same ScriptableObject (SO) - in runtime, each A, B and C hold this SO but each one has different runtime values in the fields in the instantiated SO versions...

    Can ES3 save that ? (before I go burning time, so to speak)...?
     
  39. JoelAtMoodkie

    JoelAtMoodkie

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

    This is possible, but you would need to be careful about the order in which you save and load them. Fields of ScriptableObjects will be stored by reference, so you will need to save any ScriptableObjects you instantiate (or an array of them).

    Then before loading anything which references these ScriptableObjects, you would need to load this array so that instances with those instance IDs are created. You will then be safe to load the objects which reference these ScriptableObjects.

    All the best,
    Joel
     
    Duffer123 likes this.
  40. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Excellent - thanks @JoelAtMoodkie - that makes sense - I'd need to overwrite back in the saved data to those instances first or other things referencing them (even if they were in an array or list) would fall foul...

    I am guessing the straight global save scene and all prefabs style approach would fall foul also in most circumstances?
     
  41. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Hi there,

    I have a question about the order of loading data.
    my problem explained in the attached image.

    All the best,
     

    Attached Files:

    Last edited: Aug 24, 2020
  42. JoelAtMoodkie

    JoelAtMoodkie

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

    It would depend on how you save it, but generally yes. However, it's strongly recommended you only save the data in your scene which changes anyway, as most things don't need to be serialised.

    All the best,
    Joel
     
    Duffer123 likes this.
  43. JoelAtMoodkie

    JoelAtMoodkie

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

    The only way around this is to ensure that you load the objects in the order that they're required. It's not possible to load a reference to an object which doesn't exist.

    All the best,
    Joel
     
  44. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193

    Hi

    Im saving List of gameobjects that can be generated at runtime, position of each one in the hierachy list can be changed.

    I still tying to find solution.
    Like loading all gameobjets than enable scriptes to find relation between them.

    Best Regards
     
  45. JoelAtMoodkie

    JoelAtMoodkie

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

    I'm afraid I'm not sure what you're asking. Would you be able to create a basic script which I can drop into a scene which demonstrates the issue you're having?

    All the best,
    Joel
     
  46. amybuc95

    amybuc95

    Joined:
    Nov 18, 2015
    Posts:
    7
    Hello, I've been trying to save a list of scriptable objects, but with no luck - I couldn't find any documentation for saving/loading lists in ES3, and whether there's any extra steps to get them working, so I'd be so so grateful for any help!!

    Here are my save/load functions:

    Code (CSharp):
    1.     public void saveData() //This is run at onApplicationQuit
    2.     {
    3.         Debug.Log("Saving");
    4.  
    5.         //Saving Data
    6.         ES3.Save("waterData", gameObject.GetComponent<GameManager>().pastDailyLogs); //This 'pastDailyLogs' object is a list of scriptableobjects
    7.      
    8.     }
    9.  
    10.     public void loadData() //This is run at Start
    11.     {
    12.         if (ES3.KeyExists("waterData"))
    13.         {
    14.             Debug.Log("Loading Data");
    15.  
    16.             //Loading data back into that pastDailyLogs list
    17.             ES3.LoadInto("waterData", gameObject.GetComponent<GameManager>().pastDailyLogs);
    18.         }
    19.         else
    20.         {
    21.             Debug.Log("ES3 key doesnt exist, not loading");
    22.         }
    23.      
    24.  
    25.     }

    The pastDailyLogs list is just a list of pretty basic scriptable objects, which look like this:

    Code (CSharp):
    1. public class WaterLog : ScriptableObject
    2. {
    3.  
    4.     public DateTime dateTime;
    5.     public int waterDrank;
    6.     public int waterGoal;
    7.  
    8.  
    9. }


    So the debug logs before saving and loading are running, and the key "waterData" is definitely being saved, but even if the list is saved with multiple WaterLog objects in it, upon opening the game again the list logs as being empty. There's no errors or exceptions being thrown.

    Is there something I need to do to make sure the objects inside the list are being saved as well, or should they be being saved by default when the list itself is saved? Or, if someone could point me in the direction of an example of a list of scriptable objects being saved with ES3, I'd be beyond appreciative!

    Thank you!!

    Amy
     
    Last edited: Sep 1, 2020
  47. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Hi Amy, and thanks for getting in contact.

    ES3.LoadInto is used to load data into an existing instances or instances of an object. In your case you should use ES3.Load instead. I.e.

    Code (CSharp):
    1. gameObject.GetComponent<GameManager>().pastDailyLogs = ES3.Load<List<WaterLog>>("waterData");
    All the best,
    Joel
     
  48. amybuc95

    amybuc95

    Joined:
    Nov 18, 2015
    Posts:
    7
    Joel, you're the absolute best. Works perfectly, thanks so much!
     
    JoelAtMoodkie likes this.
  49. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi Joel,

    Can we have binary load and save for some basic data type arrays please?

    bool, int, float, double, string, vector2,3,4 in approx 3 dimensions?

    Larger arrays In es3 are extremely slow in xml and blowing up file sizes exorbitant.

    Or do you have a script solution you can post here please?

    I thought about to pack the array data into a string, but string can't save 0 values.

    Thank you!
     
  50. JoelAtMoodkie

    JoelAtMoodkie

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

    We're currently working on binary formatting but it's not a trivial thing to implement. In general the major bottleneck is the quantity of data you're saving rather than the formatting itself however. Would you be able to use Unity's profiler to see where the bottleneck is? If you show me the code you're using to save and load I might also be able to provide advice on performance improvements.

    Also be aware that there is compression if file size is an issue.

    You might also consider saving the array to individual rows of a CSV file using ES3Spreadsheet, which minimises the amount of formatting.

    All the best,
    Joel
     
    Quatum1000 likes this.