Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Discontinued] Unity Save Load Utility (Free!) - Save and load your data

Discussion in 'Assets and Asset Store' started by Cherno, Oct 9, 2016.

  1. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    Check if any other variable of the same script or class gets saved properly. Also look into using attributes as detailed in the USLU manual.
     
  2. Deleted User

    Deleted User

    Guest

    I checked the manual before, and I tried adding the [SaveMember] indicator before each variable I wanted to save. Still, nothing. I also tried what you just suggest, and for some reason, only the variables that were assigned on the prefabs themselves stay (I think). Its kinda hard to tell, since as soon as the blocks are loaded, they try to generate terrain, which in-turn changed the variables. It seems like what happens is if the variables had been changed since they were instantiated, then the variables just revert to the prefab. I even tried re-writing the terrain generator and making it so the script was destroyed once it finished all axis. Still, upon loading, the script re-appeared with all of the variables from the prefab.
     
  3. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    Sounds too compley to wrap my head around. I suggest inserting Debug.Log lines before and after loading and saving and during the terrain generation process.
     
  4. Deleted User

    Deleted User

    Guest

    Ok, no worries. I can probably just make my own system to fix it. Thanks for all of your help! I can't tell you how much this has benefitted the development of my game.
     
  5. Sigma266

    Sigma266

    Joined:
    Mar 25, 2017
    Posts:
    99
    Hello, I downloaded your asset and it's pretty great, but i'm facing a pretty important issue here. There's a certain gameobject that I use to raise characters' stats, but loading it up it's giving me trouble. Whenever it's loaded, all of its components are turned off, children included, and the variables are not saving. Yes, the OI is attached, I named the variable the same as the prefab's name, the prefab it's stored in the Resources folder, and the variables that are supposed to be saved all have the [SaveMember] attribute. What am I doing wrong?
    Thank you!

    EDIT: Oh, and apparently, adding the [SaveMember] attribute to a list that stores skills(the skills are gameObjects with a particular script attached) for my characters throws an error and doesn't allow me to save anything at all. EDIT 2: Nvm, it's not giving an error anymore but it won't save the list's content.
     
    Last edited: Mar 25, 2018
  6. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    I seem to remember that the [SaveMember] attribute is only needed if only certain members of a class should be saved and loaded. Why components are disabled after loading I have no idea. Perhaps it will help if you try to use the test scene as the base and go from there.
     
  7. Sigma266

    Sigma266

    Joined:
    Mar 25, 2017
    Posts:
    99
    I did try with the test scene, but nothing. The gameObject's that is supposed to raise stats remains the same as the prefab except for the components that are not enabled, which I assume has to with the fact that everytime a scene is loaded the objects are destroyed. And yet, most of the objects I choose save and load just fine.

    Oh and what exactly does this mean? It happens randomly whenever I load a game.
    Immagine.png
     
    Last edited: Mar 26, 2018
  8. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    It's likely a problem with a certain collection-custom class combination. I will discontinue support for this asset since it has become clear to me that saving and loading a Unity scene in an all-encompassing way is far too difficult with a free product that requires constant updates and testing as well as support for users (as this thread shows). I will keep the download link since it can still serve as the way it was originally intended, namely a way to show how such a system could be attempted.
     
  9. Sigma266

    Sigma266

    Joined:
    Mar 25, 2017
    Posts:
    99
    Oh, that's a bummer. Well, do you know anything about the paid asset? Easy Save? I have too many things to think about and I can't really deal with this kind of system right now. Thanks, and sorry for the trouble.
     
    Tnrsn likes this.
  10. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    I have no experience with any of the save-load assets from the store.
     
  11. Sigma266

    Sigma266

    Joined:
    Mar 25, 2017
    Posts:
    99
    I see, thanks anyway.
     
  12. RavenBekker

    RavenBekker

    Joined:
    Sep 26, 2017
    Posts:
    3
    Hello, could you please tell me how i can change the save path?
     
    Last edited: May 10, 2018
  13. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    Look through the scripts, it is declared in one of the variables. IIRC it can also be changed from the inspector.
     
  14. RavenBekker

    RavenBekker

    Joined:
    Sep 26, 2017
    Posts:
    3
    ok thanks
     
  15. RavenBekker

    RavenBekker

    Joined:
    Sep 26, 2017
    Posts:
    3
    Hello again! I don't know why this isn't working but when i try to load my save it only loads part of it and leaves out the rest even though it has an object-marker script and the prefab is in the resources/prefabs folder.

    here are some screen shots and the error message i'm getting:

    saved vision:



    loaded version:



    (ignore the extra logs)

    error message:

    Code (CSharp):
    1. MissingMethodException: Method not found: 'Default constructor not found...ctor() of UnityEngine.Material'.
    2. System.Activator.CreateInstance (System.Type type, Boolean nonPublic) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:368)
    3. System.Activator.CreateInstance (System.Type type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:254)
    4. SaveLoadUtility.ReadFromDictionary (System.Type fieldType, System.String fieldName, System.Object fieldValue, System.Reflection.FieldInfo baseInstanceField, System.Reflection.PropertyInfo baseInstanceProperty, System.Object baseInstance) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1251)
    hopefully this is enough information.

    also i put in the save to path "c:\FOLDERNAME" and its not their even though i have saved stuff to it
     
  16. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    This asset is no longer supported, as the thread title says.
     
  17. BruteForce93

    BruteForce93

    Joined:
    Dec 26, 2018
    Posts:
    1
    This USLU is awersome utility, i want use it for my own game save maps items and location, yo ureally help me in developing, thank you very much!! Love USLU, are really AWERSOME! Great Job Bro, really Great Job!
     
  18. slimgiltsoul

    slimgiltsoul

    Joined:
    Aug 4, 2017
    Posts:
    3
    I really wish the manuals were still up, even though it's not supported. People could read them quietly and not bother you. Thank you for your hard work.
     
  19. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    I have reuploaded both files. The manuals were always part of the main package, though.
     
    slimgiltsoul likes this.
  20. ad48hp

    ad48hp

    Joined:
    Sep 18, 2013
    Posts:
    12
    Wouldn't ya matter if i, or someone else would continue this project open-source, on Github, let's say ?
     
  21. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    I don't care. However, I don't think it's worth it since the attempt of a "catch-all"-implementation is fundamentally flawed and will never work in 100% of the cases.
     
  22. Notso

    Notso

    Joined:
    Oct 25, 2015
    Posts:
    42
    Hello..Hope you still answer questions about this....(If not I understand, this is a temp solution for us but if we can fix this 1 issue it will be great for a little while!))
    I finally got the original serialization to sort of work then saw your 'advanced' version.
    I have a weapon, and when I select save mode (any but list exclusive) it gives no error and puts it back to its original prefab location, rotation, not saving the values (condition and ammo)..NOW when I select List Exclusive I get it to save AND load the values as well..BUT I get an error that causes other objects being saved to act weird. So yay, it does what I want, but boo I can't use it...

    NullReferenceException: Object reference not set to an instance of an object
    SaveLoadUtility.SetValues (System.Object& baseInstance, System.Collections.Generic.Dictionary`2[TKey,TValue] baseDict) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1211)
    SaveLoadUtility.ReadFromDictionary (System.Type fieldType, System.String fieldName, System.Object fieldValue, System.Reflection.FieldInfo baseInstanceField, System.Reflection.PropertyInfo baseInstanceProperty, System.Object baseInstance) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1640)
    SaveLoadUtility.SetValues (System.Object& baseInstance, System.Collections.Generic.Dictionary`2[TKey,TValue] baseDict) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1241)
    SaveLoadUtility.ReadFromDictionary (System.Type fieldType, System.String fieldName, System.Object fieldValue, System.Reflection.FieldInfo baseInstanceField, System.Reflection.PropertyInfo baseInstanceProperty, System.Object baseInstance) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1521)
    SaveLoadUtility.SetValues (System.Object& baseInstance, System.Collections.Generic.Dictionary`2[TKey,TValue] baseDict) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1241)
    SaveLoadUtility.ReadFromDictionary (System.Type fieldType, System.String fieldName, System.Object fieldValue, System.Reflection.FieldInfo baseInstanceField, System.Reflection.PropertyInfo baseInstanceProperty, System.Object baseInstance) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1640)
    SaveLoadUtility.SetValues (System.Object& baseInstance, System.Collections.Generic.Dictionary`2[TKey,TValue] baseDict) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1241)
    SaveLoadUtility.UnpackComponent (UnityEngine.GameObject& go, ObjectComponent obc) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1205)
    SaveLoadUtility.UnpackGameObject (SceneObject sceneObject, UnityEngine.GameObject go) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:1161)
    SaveLoadUtility.LoadGame (System.String saveGameName) (at Assets/Unity Save Load Utility/SaveLoadUtility.cs:294)
    SaveLoadMenu.Update () (at Assets/Unity Save Load Utility/SaveLoadMenu.cs:84)