Search Unity

Easy Save - The Complete Save Data & Serialization Asset

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

  1. Nayell

    Nayell

    Joined:
    Dec 31, 2021
    Posts:
    2
    Hi
    im trying to save and load my player placement using a save and load buttons
    the problem is that when i save it works fine but when loading my player position stays the same(im a real beginner with this system, i cant figure it out) here are the two methods

    public void Load()
    {
    ES3AutoSaveMgr.Current.Load();
    }



    public void Save()
    {
    ES3AutoSaveMgr.Current.Save();
    }
     
  2. JoelAtMoodkie

    JoelAtMoodkie

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

    please could you post a screenshot of what you have selected in the Auto Save window for that specific object in that scene?

    I also recommend putting a Debug.Log call before your ES3.Load call to ensure that it is being called.

    All the best,
    Joel
     
  3. Nayell

    Nayell

    Joined:
    Dec 31, 2021
    Posts:
    2
    thank you for replying:D,ive selected only the player

    Capture d’écran (23).png
    and for the transform parameters
    Capture d’écran (17).png
    i also enabled the "save children" in the ES3 script on the player so that it saves the camera and his body.

    note that when i enable Load event on start it actually puts the player where i saved last time
    but when using Load button it doesnt work even if the debug.log works

    when i enabled log info in the debug settings it shows this
    Capture d’écran (20).png
    does ------ mean that its loading the objects?
     
    Last edited: Jan 27, 2022
  4. JoelAtMoodkie

    JoelAtMoodkie

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

    Please could you create a new project with a simple scene which replicates your issue and private message it to me with instructions? It’s not possible for me to replicate this from what you’ve sent.

    All the best,
    Joel
     
  5. Overlogical

    Overlogical

    Joined:
    Sep 12, 2020
    Posts:
    12
    Hi Joel,
    after creating an asmdef in my root script folder I get : error CS0246: The type or namespace name 'ES3Spreadsheet' could not be found (are you missing a using directive or an assembly reference?)
    I already added manually my assembly name to ES3Defaults which removed similar errors, but this one sticks. Any idea what I am doing wrong?
    Cheers,
    Jan
     
  6. JoelAtMoodkie

    JoelAtMoodkie

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

    As this is part of Unity’s functionality rather than ours, this question may be better aimed at Unity. However, you would need to ensure that Assembly-Csharp-firstpass is accessible to your assembly.

    Easy Save is in the Plugins folder so that it is compiled before other scripts in the “firstpass” of compilation.

    If this isn’t the issue it may indicate a bug at Unity’s end, as we do nothing non-standard with our scripts so Unity should be able to pick them up.

    All the best,
    Joel
     
  7. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Just one other thing which came to mind (apologies for the double post), you might need another asmdef in the Plugins folder to be able to make it a dependency of your main asmdef. Otherwise your asmdef will be compiled before Easy Save.

    All the best,
    Joel
     
  8. SomeHumbleOnion

    SomeHumbleOnion

    Joined:
    Jan 18, 2021
    Posts:
    28
    Hello!

    I'm loving the ES3 system so far but I'm having trouble deleting references from my ES3 Reference Mgr. I've added these references by right clicking on my object > ES3 > Add Reference. But now there isn't any way to remove it from the list of references.

    I've tried setting the list element to 'none' but that does nothing. Any advice on this is greatly appreciated!
     

    Attached Files:

    • s1.PNG
      s1.PNG
      File size:
      61.5 KB
      Views:
      280
  9. JoelAtMoodkie

    JoelAtMoodkie

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

    Is there any reason you want to remove the reference? The reference list is only there to view references for debugging issues and removing references isn’t usually necessary as they have essentially no overhead.

    All the best,
    Joel
     
  10. SomeHumbleOnion

    SomeHumbleOnion

    Joined:
    Jan 18, 2021
    Posts:
    28
    Thanks for the reply! I mainly wanted to get rid of the references since I don't need to save some of those objects anymore. I wasn't sure how much of an overhead they had though, so if it's not that bad then I may just leave them in.

    I'm still curious if it's possible to delete individual elements from the reference list though. Thanks!
     
  11. SomeHumbleOnion

    SomeHumbleOnion

    Joined:
    Jan 18, 2021
    Posts:
    28
    Ahhh my apologies. I see the Optimize button will get rid of un-used references. That's basically what I was looking for!
     
    JoelAtMoodkie likes this.
  12. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    I bought EasySave in 2012. Im finally trying it:)

    I have 2 errors on import into Unity 2019.4. Theres no errors in a clean project so it must be something iy project but I cant figure out what. Im using iOS but no error on that in clean project as well. No other console error besides these two.

    Code (CSharp):
    1. Assets/Plugins/Easy Save 3/Scripts/ES3.cs(729,38): error CS0103: The name 'UnityWebRequestMultimedia' does not exist in the current context
    2.  
    3. Assets/Plugins/Easy Save 3/Scripts/ES3.cs(741,24): error CS0103: The name 'DownloadHandlerAudioClip' does not exist in the current context
    Any ideas? or can I delete this function or comment it out since I dont use any web features?

    Screen Shot 2022-02-23 at 8.29.28 PM.png
     
  13. JoelAtMoodkie

    JoelAtMoodkie

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

    This appears to be a bug at Unity's end as those APIs certainly exist in 2019.4 (see screenshot).



    Are you on the latest version of 2019.4? I don't appear to be getting any errors in the latest version, and have had no other reports of these errors.

    All the best,
    Joel
     
    protopop likes this.
  14. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    Yeah, it must be something in my project because it works fine in a clean project. I just cant imagine what setting - publishing or otherwise - or installed asset could interfere with what should be an accessible API. Ill do some research outside to try and find out, I just thought in case anyone had encountered this (or serahces for similar errors) I might get a hint. Thanks for maintaining the app so long. Its obviously loved by many, many users:)
     
  15. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Let us know what you discover, or if you find a way of replicating it. And thanks for the kind words :)

    All the best,
    Joel
     
    protopop likes this.
  16. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    Thank you:) I started a thread to try and track it down:
    https://forum.unity.com/threads/does-not-exist-in-the-current-context.1245715/#post-7927420

    Its not an error in EasySave for sure, but it is preventing me from using Easy Save in my project, so if it yields fruit I will share it here. And I anyone comes across this who might have a suggestion or any hint, even if its out there, please let me know on the thread I linked to here - I appreciate it.
     
    JoelAtMoodkie likes this.
  17. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    I found it. Unity Web request is disabled in my project. It's a built in package, but it says it implements a legacy feature - I think it's included for backwards compatibility.

    Screen Shot 2022-02-26 at 5.17.35 PM.png
     
    JoelAtMoodkie likes this.
  18. Sir_Loin_of_Beef

    Sir_Loin_of_Beef

    Joined:
    Jul 26, 2021
    Posts:
    8
    Hello, I'm have a hard time trying to just save everything in the scene. I have a checkpoint that triggers at the start of the game that should save everything in the scene and, when the player dies, it should be loaded again. Thanks!
     
  19. JoelAtMoodkie

    JoelAtMoodkie

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

    I've replied to your email.

    All the best,
    Joel
     
    Last edited: Mar 16, 2022
    Sir_Loin_of_Beef likes this.
  20. vrgz

    vrgz

    Joined:
    Apr 20, 2011
    Posts:
    34
    hello
    I use bolt and easy save3.
    I add
    ES3Spreadsheet to my bolt unit

    but I can not find getcell and setcell

    please help me
    what es3 unit I miss? 111111111111.jpg
    2222222222222222.jpg
     
  21. JoelAtMoodkie

    JoelAtMoodkie

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

    This appears to be a bug at Bolt's end not recognising the generic methods.

    I'll report this to the Bolt/Unity Visual Scripting team. However, in the meantime I've created a version which includes non-generic methods for these to work around this bug. If you private message me or contact me via moodkie.com/contact I'll send this update directly over to you.

    Regarding the issue mentioned in your negative review on the Asset Store page, I've responded with the following:

    All the best,
    Joel
     
    Last edited: Mar 22, 2022
  22. vrgz

    vrgz

    Joined:
    Apr 20, 2011
    Posts:
    34


    I'm very sorry I'm here again


    ES3Spreadsheet.Load cannot be used in the new bolt node. Using this node, unity will crash down 100% without any error immediately,Save is correct.
    my unity is 2020.3.17.f1
     
  23. vrgz

    vrgz

    Joined:
    Apr 20, 2011
    Posts:
    34
    update:I try myself and delete the red part of the code
    and now It work correct!!!

    upload_2022-3-23_17-16-11.png
     
  24. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Thanks for the info, that's definitely a bug at Bolt's end, though it's strange that I don't appear to be able to replicate it at my end.

    First ensure you're on the latest version of Bolt. If so, if you're able to send a bug report to the Bolt team that would be appreciated. It looks like they've not accounted for the situation where there's both a generic and non-generic version of the same method. In the meantime I'll send a slightly different version which provides different parameters for the non-generic method.

    All the best,
    Joel
     
  25. Smellydave

    Smellydave

    Joined:
    Sep 20, 2013
    Posts:
    6
    Hiya,
    I have just started using Easy Save 3 and am struggling at the first hurdle with a few test saves.

    I am trying to use autosave with a few items on an script with don't destroy on load. I read in another reply that I should also include the ES3 Manager on the DDoL which I have.

    If I save and load while in the original scene all is fine and works perfectly, but if I leave the scene and then come back to it when I load a new object is created with a copy of the saved script.

    I would be really grateful for any help!!

    Thank you

    David
     
  26. JoelAtMoodkie

    JoelAtMoodkie

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

    Because marking something as DontDestroyOnLoad essentially puts it into a new scene, it's not possible to save them using Auto Save as the object will no longer exist in the scene where your Auto Save manager is.

    In this case you would need to use code. I.e.

    Code (CSharp):
    1. // To save
    2. ES3.Save( "yourKey1", yourDDOLObject1 );
    3. ES3.Save( "yourKey2", yourDDOLObject2 );
    4. // etc
    5.  
    6. // To load
    7. ES3.LoadInto( "yourKey1", yourDDOLObject1 );
    8. ES3.LoadInto( "yourKey2", yourDDOLObject2 );
    9. // etc
    All the best,
    Joel
     
  27. Smellydave

    Smellydave

    Joined:
    Sep 20, 2013
    Posts:
    6
    Thanks Joel,

    Appreciate the quick answer - especially on a Saturday!!

    David
     
    JoelAtMoodkie likes this.
  28. Sir_Loin_of_Beef

    Sir_Loin_of_Beef

    Joined:
    Jul 26, 2021
    Posts:
    8
    Hi again, I'm trying to save a prefab and load it between scenes. From what I read, I can accomplish this by using a Global Reference, but I can't find any documentation or settings besides "use global references". Even with it enabled and the prefab setup correctly, it doesn't load when starting a new scene that has ES3 set up the same way. So in short, how can I save a prefab then load it when a new scene is loaded? Thanks!
     
  29. JoelAtMoodkie

    JoelAtMoodkie

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

    You can find information on saving and loading prefab instances in the Saving and Loading GameObjects guide:

    https://docs.moodkie.com/easy-save-3/es3-guides/saving-loading-gameobjects-prefabs/

    Note that global references are not used for this purpose, and are only used internally (which is why they’re not documented).

    All the best,
    Joel
     
  30. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    So far I've been mucking around and got a system that creates the classic 4 save slots working great and it's clever enough to check if the file exists and if it doesn't it will create one.

    I know you told me last time about using a catch file IO exception to check if the file is open or not but
    what about if the directory exists or not?
    Should I worry about if the directory doesn't exist then create one or is this something that Easy save automatically handles for me so I don't have to worry about it?
    To take it a step further what about if the directory is in use and can't be modified-is that even a thing?
     
  31. JoelAtMoodkie

    JoelAtMoodkie

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

    You don’t need to check that the Directory exists because Easy Save does this for you. However, if you’re letting users choose their own path (we don’t recommend this unless absolutely necessary) then you’ll want to ensure that they have permission to write there. This will throw a SecurityException or UnauthorizedAccessException if they do not have permission.

    This isn’t a thing thankfully.

    All the best,
    Joel
     
  32. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I am not letting users choose their own path I am doing the default persistent data path.
    When you say easy save handles existence of directory how does it do that during a game play build at run time?
    Will the same code I used works great for my Windows machine so in theory it should also work great for Mac and Linux (except console and phone right?).
    What about WebGl?

    I think the main thing I need to watch out for people opening and modifying the CSV while the game is running. Since it's being used my build can't save or read from it so putting that system IO catch exception would come into play that you sent.

    If ES3 has encryption that would make this easier too.

    If people are in the process of cutting and pasting the file I suppose that same catch exception would also come into play and if the file completes the cut and paste operation or they rename the file my game assumes it doesn't exist and will create a new one AT START but if they do it mid game I think I should assume this is tampering and stop and exit the game.

    Maybe I am being over protective but it's good to get a clear standard on how people normally address this stuff. I'd like to know your commentary on all what I've said ere it's fascinating.
     
    Last edited: May 4, 2022
  33. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Easy Save automatically does this for you, so you can use the same code on each platform.

    Just in case you’ve not already found it:
    https://docs.moodkie.com/easy-save-3/es3-guides/es3-encryption-compression/

    For anti-tampering you would generally use encryption and catch the CryptographicException or InvalidFormatException. If you’re encouraging users to open the file then I wouldn’t use the file being open as a flag for tampering. They could leave the file open after copy/pasting, or preempt needing to open the file and open it before they load the game. So really you can’t correlate the file being open to tampering.

    All the best,
    Joel
     
  34. sebasfreelance

    sebasfreelance

    Joined:
    Aug 27, 2015
    Posts:
    240
    Hi,
    how would it be to save the rotation?

    Code (CSharp):
    1.     // Generate a unique ID for this GameObject.
    2.     public string guid = System.Guid.NewGuid().ToString();
    3.  
    4.     void Awake()
    5.     {
    6.         transform.localPosition = ES3.Load<Vector3>(guid, transform.localPosition);
    7.         transform.localRotation?
    8.     }
    9.  
    10.     void OnDestroy()
    11.     {
    12.         ES3.Save<Vector3>(guid, transform.localPosition);
    13.         ES3.Save<Vector3>(guid, transform.localRotation?)
    14.     }
    thaks!
     
  35. JoelAtMoodkie

    JoelAtMoodkie

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

    Rotation is a Quaternion, not a Vector3, so you would use this as the generic type.

    Also you’re using the same key for both save calls, which means you’ll just be overwriting your position with the rotation. I recommend appending “position” and “location” to the keys so that they’re unique.

    Code (CSharp):
    1.     // Generate a unique ID for this GameObject.
    2.     public string guid = System.Guid.NewGuid().ToString();
    3.     void Awake()
    4.     {
    5.         transform.localPosition = ES3.Load<Vector3>(guid + "position", transform.localPosition);
    6.         transform.localRotation = ES3.Load<Quaternion>(guid + "rotation", transform.localRotation);
    7.     }
    8.     void OnDestroy()
    9.     {
    10.         ES3.Save<Vector3>(guid+"position", transform.localPosition);
    11.         ES3.Save<Quaternion>(guid+"position", transform.localRotation);
    12.     }
    All the best,
    Joel
     
    Last edited: May 11, 2022
  36. sebasfreelance

    sebasfreelance

    Joined:
    Aug 27, 2015
    Posts:
    240
    Thank you very much for the information! It works fine for me now with the instructions.
    I take this opportunity to congratulate you on this asset, very happy with the purchase.
     
    JoelAtMoodkie likes this.
  37. PharmacyBrain

    PharmacyBrain

    Joined:
    Sep 8, 2020
    Posts:
    6
    Easy Save 3 references the Visual Scripting namespace. When I remove visual scripting I see errors related to the missing namespace. If I am not using visual scripting is this going to pull it into my final build? As I understand it only referenced assets are included in the build. I want to keep things as lean as possible and I don't want packages being included in the build I am not going to use.
     
  38. JoelAtMoodkie

    JoelAtMoodkie

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

    The parts of our API which reference visual scripting are only compiled if the UNITY_VISUAL_SCRIPTING define directive is specified. It looks like this define wasn’t removed when the Visual Scripting package was removed. To remove it:

    (https://docs.unity3d.com/Manual/CustomScriptingSymbols.html)

    All the best,
    Joel
     
    profGumidek and PharmacyBrain like this.
  39. PharmacyBrain

    PharmacyBrain

    Joined:
    Sep 8, 2020
    Posts:
    6
    Quirky fun. If you remove the UNITY_VISUAL_SCRIPTING directive and try to X out of the settings window you'll be prompted to apply your settings. If you hit yes using this pop-up the settings are not applied and the directive comes back.

    However, if you remove the directive and hit the apply button the settings are applied.

    I've had a few issues with the project settings window not saving in the current LTS. Anyway, thanks for the help.
     
  40. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    That’s very strange, thanks for the info. I definitely recommend sending a bug report to ensure they’re aware of this (assuming you’re on the latest version of Unity).

    all the best,
    Joel
     
  41. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    I have a csv with a bunch of data. I have followed the simple guide to loading the data but I just get a 'Value cannot be null' error . My csv file is saved in the Assets/Resources folder. What I have I done wrong? (I presume its the location of the csv file?!?) Thanks
     
  42. JoelAtMoodkie

    JoelAtMoodkie

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

    Have you set the storage location to Resources? Please could you show me the code you're using and the CSV file you're trying to load?

    All the best,
    Joel
     
  43. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Ah, setting the storage location in setting was the missing link. Missed that part.Thanks.

    ALthough now I get an error : Input string was not in a correct format.

    My Csv is just a very simple test with some strings and ints..attached
     

    Attached Files:

  44. JoelAtMoodkie

    JoelAtMoodkie

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

    Please could you show me the code you are using so I can try to replicate it at my end.

    EDIT: Also an issue with your CSV files, strings should be in quotation marks to be safe (but it should work without these too).

    All the best,
    Joel
     
    Last edited: Jun 1, 2022
  45. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Code (CSharp):
    1.     void Start()
    2.     {
    3.         // Create a blank ES3Spreadsheet.
    4.        var sheet = new ES3Spreadsheet();
    5.         sheet.Load("Level_Data.csv");
    6.         // Output the first row of the spreadsheet to console.
    7.         for(int col=0; col<sheet.ColumnCount; col++)
    8.         {
    9.             Debug.Log(sheet.GetCell<int>(col, 0));
    10.          }
    11.     }
    12.  
     
  46. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Ah I think I see it now as I paste it. its set to 'int' type because I just cut pasted from the manual to get started. DOh!
     
  47. JoelAtMoodkie

    JoelAtMoodkie

    Joined:
    Oct 18, 2009
    Posts:
    914
    Glad you managed to identify the issue :)

    All the best,
    Joel
     
  48. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Hi I have a lot of .es3 files (More than thousand) that I saved unencrypted ... is that possible to create a tool to encrypt all .es3 files inside a folder? I need to encrypt for the final build.
     
  49. JoelAtMoodkie

    JoelAtMoodkie

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

    To do this you would do something along the lines of the following:

    Code (CSharp):
    1. foreach(var filename in ES3.GetFiles())
    2. {
    3.     var unencryptedSettings = new ES3Settings(ES3.EncryptionType.None);
    4.     var encryptedSettings =  new ES3Settings(ES3.EncryptionType.AES);
    5.    
    6.     var unencryptedString = ES3.LoadRawString(filename, unencryptedSettings);
    7.     ES3.SaveRaw( unencryptedString, filename, encryptedSettings );
    8. }
    All the best,
    Joel
     
  50. JoelAtMoodkie

    JoelAtMoodkie

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

    I’m afraid it’s hard to understand without being able to see your FSMs.

    Please could you take screenshots of each of the actions you are using so I can see what you are doing?

    All the best,
    Joel