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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

UniSave v2.0 - Save System [Editor Extension]

Discussion in 'Assets and Asset Store' started by MajinMHT, Aug 26, 2014.

  1. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    Hi everyone! It's been quite some time since I've posted on the forums. I've been away due to personal issues, but I'm back now and have just released something I've been working on. To those I promised this update months ago, I apologize for the long wait.

    With version 2.x, I want to reintroduce UniSave. The system has been overhauled, new features have been added, and everything has been rewritten from scratch. I wanted it to be easier to use, without you having to write extra code just to save a custom component. The system now handles everything internally, making it very easy to save your game objects.




    Current Version:
    2.1.1​


    UniSave is a powerful and easy to use save system for Unity. It let’s you save your game’s levels, creates save files, and has extra features that can be used with a simple API.

    Plug & Play
    To setup your game for saving, no extra coding is required. UniSave comes with a special component called SaveableObject which you add to the game object that you want to save. It will display a list of all the components on your game object. You just select what you want to save from the list, write one line of code to call UniSave, and your save file is created!

    MultiScene Persistency
    UniSave’s most powerful feature allows you to travel between scenes while they keep their saved states. If your level or world consists of multiple scenes where the player can go back and forth, the transition will feel persistent, because the system remembers the changes in your scenes. MultiScene Persistency works even without saving to a file.

    Scene Transitions
    With support for loading screens you can use a customized loading screen whenever you’re loading a save file or a scene, or use the built-in fade effect.

    Save Files
    Unlike Unity’s built-in PlayerPrefs, UniSave let’s you save your data to save files, and has no limitation on size. Save Files are encrypted and non-readable, so they can’t be tampered with. They are also forwards compatible with newer versions of your game.


    For more information, please check out the links above!


    The UniSave package contains the C# source code, an example project, and an offline version of the manual.

    You can purchase UniSave in either the Unity Asset Store or on the UniSave homepage. If you already own UniSave, you can download the update for free.

    If you have any feedback, questions, suggestions, etc., then please post them in this topic. I look forward to hearing from you! :)
     
    Last edited: Dec 17, 2014
  2. ClockworkMask

    ClockworkMask

    Joined:
    Oct 4, 2014
    Posts:
    1
    Thank you for making this! Being able to save multiple scenes is just what I needed.
     
    aaronhm77 likes this.
  3. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Does UniSave 2.0 support Windows Phone 8 / Windows Store?

    Thanks!
     
  4. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    I haven't explicitly tested UniSave on those platforms, but I see absolutely no reason why it shouldn't work. Blackberry is another platform I haven't tested, but it should work fine on that as well. As a matter of fact, it should currently work on any platform that allows you to save data locally. If someone would somehow encounter an error on these platforms, I'll be sure to fix that immediately. :)

    I want to point out you can currently get UniSave at a discounted price of $14 on my website. I've updated the first post.
     
  5. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Purchased. Thanks
     
  6. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Hi. Just purchased this, but I have one question.

    Is it possible to have multiple sub folders inside Saves folder?

    My game requires to have each scene to have its own save data so there would be many of them and I want to organize them into folders so the save games don't get mixed up or over written by other save games.

    I have tried to enter folder name along with the file name when I save scene, but it doesn't seem to work.
    Is there anyway to set the folder name of the save game under Saves?
     
  7. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Also, it would be super useful, if I can save just a selected gameobject and it's child gameobjects into a save file. (instead of whole scene)

    I want to have multiple game objects in the scene at roots and be able to save a gameobject and its childs as one save file and then other one as another one.

    I know you have plan to work on saving non gameobject like config and stuff, but if what I mentioned is possible, I can create a gameobject . say config and then save its data as my config file and etc...

    Example

    configGameObject = (GameObject) GameObject.Find("ConfigGameObject");
    SaveManager.Save("Config", configGameObject);

    and Load

    SaveManager.Save("Config", configGameObject);

    What do you think?

    And for setting Folder

    SaveGameManager.SetPath("SaveGame01");

    This would save to Application.persistentDataPath + "/Saves/SaveGame01/" + SaveGameName

    ??
     
  8. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    And yet another possible improvement..

    Maybe it would be cool to have a small icon next to the game object that has savable Object script attached to it, so we can identify it easily in the hierarchy. This is pretty common actually.

    I have bought this asset, but now, found myself a bit staggered by not being able to save it into my own sub folder and not being able to save selective trees of objects only into save file. :(
     
  9. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    Hi, castor76. You're right, it's currently not possible to create a subfolder within the save folder. I have to admit, it's something I just didn't think of. That's why it's a good thing these feedback topics exist.

    The saving of individual game objects as config data, as you described, is exactly what I had in mind for the config feature. But your addition of a separate folder sounds good, so I will add that as well.

    I appreciate your suggestions. :) I will incorporate them into UniSave.
     
  10. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Yeap, nothing like working together!

    I have another question about some usage case of UniSave.

    say.. I have a gameobject that already exist in the scene. And then during game play, that objects gets destroyed. The player then saves game.

    When player comes back to play the game again , the game loads the scene (which ofcourse has the destroyed gameobject because it is there by default) will, loading the game save will also destroy that gameobject upon load?

    If so, how does it know? Does SaveManager keeps list of saveableGameObject and then knows what is destroyed or not?

    And...

    It makes sense to have gameobjects that gets instantiated during runtime in the Resources folder. But what about subfolders inside Resources folder? For example :

    Resources/Weapon/Knife
    Resources/Weapon/Pistol
    Resources/Item/Bread

    It is very rare to keep every assets that is under Resources folder into just under Resources root. Normally we have to organize in a way it is easy to keep it track and sorted. How do you support this? Do you go through all subfolders inside Resources folder and then find the right gameobject to instance upon save game load?
     
  11. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    Yes, one of the nice features of UniSave is that it remembers if a game object was destroyed, and will then destroy it in the scene when loading your save file.

    I'll explain in technical detail how this works. You might find it interesting.

    When a game object is already in the scene and has a SaveableObject component attached to it, it gets added to a list on a hidden game object in the scene. This hidden game object gets automatically created in the editor and has a script on it (SaveableObjectManager) and keeps a list of these game objects. Whenever one of these game objects is destroyed at runtime, its unique ID (which is assigned to it by UniSave when adding the SaveableObject component) stays in the list. When saving the scene, it simply checks the list to see if it contains items with null game objects (which means it's destroyed), and then saves the unique ID of these game objects as a reference for destroying them when loading the save file.

    Now you know about some of the magic that happens behind the scenes. :p

    About the Resources folder...

    UniSave saves the name of the asset, and then Resources.Load() does the job of going through all the subfolders automatically. There's only one limitation to this, and that's having multiple assets with the same name. For example:

    Resources/MyObject.prefab
    Resources/SubFolder/MyObject.prefab

    In this situation it will load the first one, because it's the first asset with that name that Resources.Load() finds. If the asset in the root folder wouldn't exist, it would load the one in the subfolder just fine. Having assets with duplicate names is currently a problem. The reason why this problem exists is because it's not possible to get the file path to an asset at runtime. So as long as multiple assets don't have the same name, you can use subfolders.
     
    Last edited: Dec 8, 2014
  12. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Thanks, it's all nice to know.

    Forcing to have unique name is something that I can work with. It's good practice to have the assets to have different names anyway.

    Just curious... the SaveableObjectManager .. what happens to it during the scene load? When does it created? Who create it? I am asking this.. because this is how I am intend to use it.

    I have a main scene with my game settings and all other gameobjects that function as my managers to handle game play and they can have saveableObjects with them.

    Now I have many other level scenes which I do async load it. These scenes ofcourse contains the saveableObjects.

    The manager game objects from the first scene is not going to be destroyed because I tagged them to DoNotDestroyOnLoad.

    So the question is does SaveableObjectManager gets created on all the scenes? If so do you take care of multiple instances of SaveableObjectManagers? (do you prevent them from having more than one at anytime ?)

    If SaveableObjectManager don't get destroyed during scene load, does it also handle the saveableObjects from other loaded scene? (or are they have to be handled by the different SaveableObjectManager?

    I am sorry if you got confused with my question as it can be a bit difficult to explain.

    :D
     
  13. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    That's a really good question, and I understand it perfectly. :)

    Every scene has its own SaveableObjectManager that belongs to it. It gets created automatically as soon you add a SaveableObject component to a game object in your scene in the editor. When you load another scene, the SaveableObjectManager of the current scene gets destroyed, so there is always one per scene.

    Also, I want to point out that I'm currently using your game scenario for testing purposes with the new update to make sure it will work for you when it's released. :)
     
    Last edited: Dec 8, 2014
  14. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I see.. so the new SaveableObjectManager that is loaded from the other (level) scene is also going to take care of the saveableObjects from the main scene ( managers ) ?

    I .. assume that new SaveableObjectManager will ... scan the scene and refresh list and add the new ones ( well from the main scene that used to load the current level scene) along what it had with in its own scene?
     
  15. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Any update?
     
  16. aaronhm77

    aaronhm77

    Joined:
    Nov 22, 2012
    Posts:
    65
     
  17. aaronhm77

    aaronhm77

    Joined:
    Nov 22, 2012
    Posts:
    65
    If you have any feedback, questions, suggestions, etc., then please post them in this topic. I look forward to hearing from you! :)[/QUOTE]

    hello;

    i want a "save and load game" asset so i can save and load my games.

    i used unities free JASON asset for a wile but wanted to experiment with a more expensive asset.

    i purchased Easy Save and they did not even have a save load game example; i have written them twice waiting for a reply.

    if i pay $35.00 dollars for Uni Save will i be able to use it to save and load my games, or will it not work at all like easy save?

    does it come with a save load game example scene?

    thanks,

    Aaronhm77
     
  18. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    I've been away for a few days, so sorry for my late reply.

    A SaveableObjectManager only takes care of game objects (that were created in the editor) in the scene that it belongs to. SaveableObjectManagers don't persist between scenes.

    Yes! I'm going to upload v2.1 tomorrow. I just have to make some small changes and fix a couple of bugs, and also update the manual, and then it's ready to go. I do want to point out that it takes some time for Unity to approve submissions, so in case you purchased UniSave in the Asset Store and don't feel like waiting, I could PM you a temporary download link for the new version when it's up.

    Hi, Aaronhm77. Yes, UniSave comes with an example project that you can check out. There's also a manual (both offline and online) that's easy to follow, and tells you how features work.
     
    Last edited: Dec 13, 2014
    aaronhm77 likes this.
  19. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Hi Majin.

    I am currently doing the test , but I have grave concern about the size of saves.

    Currently, it gives about 17kb default size even if my save doesn't have much at all. Which I am ok with it.

    But..

    When I try to save a gameobject which has list of a simple int count (about 18 of them) I have increase of about 4kb.
    Now.. you may think this is nothing. But think about it... if I want to save a level with decent number of crates , boxes with items in there, I would want to have some properties like below :

    public int count;
    public float value;
    public float general;
    public bool isEquiped;
    public bool isLocked;
    public string additionalName;
    public string assetPath;

    this will make save game size HUGE.

    In my experiement and comparision with Unity Serializer plugin , my game stat save file size has increased from 17kb to 500+kb !!!

    And that was with even less data than before by using [UniSaveIgnoreDataMember] optimization.

    I know that Unity Serializer plugin has some sort of compression tech built in to reduce the size of the save game. But even taking that as a consideration, the size of the game save is just ... too big.

    I don't mind "some" increase, but this is just way too much.

    I don't know how UniSave works internally to be able to say for sure, but without making the save considerbly smaller, it can't be used for project with decent scale. Maybe it will work for a simplle mobile game.. Or something must be wrong with it because even without compression maths doesn't add up... Not sure how much overhead UniSave adds , but can't have 18 ints to have 4kb increase in size... (not that exactly cause there would be other stuff like saving list state etc.. but still...)

    Any ideas? ( I am using the new SaveObject stuff)
     
    Last edited: Dec 15, 2014
  20. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    So.. what must I do in this case?

    I have scene with managers that contain player info, stats ,config, etc... which I want to save using SaveObject function into separate save file.

    During game play, I load a level scene which contains containers that contains items for level. I want to save level's data into level01.sav etc.. and my other stats as other files.

    Now, if SaveableObjectManager is not persistent , then the SaveableObjectManager which was responsible for the stats, config is now "lost" ? and if new SaveableObjectManager doesn't take care of the stats, config how do I save them?

    You can't seriously expect to have every game object needed in the scene and game play to "exist" already in the scene created in the editor only. It is very common to use "don't destroy in load" funtion in Unity to keep the stuff that you always need and just load the other scenes in and out either normally or additively.
     
  21. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Also, I have noticed that the save files are not being over written.. So the file size keeps increasing...
     
  22. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I also get this error sometimes...

    NullReferenceException: Object reference not set to an instance of an object
    UniSave.Editor.HierarchyWindowIcon.OnHierarchyWindowItemOnGUI (Int32 instanceID, Rect selectionRect) (at Assets/UniSave/Editor/Scripts/HierarchyWindowIcon.cs:22)
    UnityEditor.SceneHierarchyWindow.OnGUIAssetCallback (Int32 instanceID, Rect rect) (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/SceneHierarchyWindow.cs:230)
    UnityEditor.TreeView.OnGUI (Rect rect, Int32 keyboardControlID) (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/GUI/TreeView/TreeView.cs:404)
    UnityEditor.SceneHierarchyWindow.DoTreeView (Single searchPathHeight) (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/SceneHierarchyWindow.cs:334)
    UnityEditor.SceneHierarchyWindow.OnGUI () (at C:/BuildAgent/work/d63dfc6385190b60/Editor/Mono/SceneHierarchyWindow.cs:178)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  23. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    And this... when you build game.

    Assets/UniSave/Scripts/SerializationHandler.cs(10,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?
     
  24. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    In earlier tests I haven't come across these file size issues, so I'm not sure what's happened there. One thing I have noticed is that saving the Transform component does add a lot of overhead, so it's usually best to avoid saving the Transform when it's not necessary. That alone can greatly reduce the file size. When dealing with lots of prefabs, an optimization technique could perhaps be implement your own check to see if a game object has actually moved before saving its transform. Disabling the SaveableObject component until it should actually be saved is also something that can be done, because a disabled SaveableObject gets ignored. But yes, there's still room for improvement there when it comes to save file sizes. The file sizes should be way smaller though, because UniSave is using Protobuf-net for serialization. I'd have to look into it.

    This is not an issue at all. I know that it is common to use load game objects additively, and you can save those just fine. It's just that for technical reasons, you have to do it a bit differently. There are two ways you can deal with this. One way is to turn the config into a prefab. When you carry a game object from one scene to another (with DontDestroyOnLoad), UniSave will automatically detect this if it has a SaveableObject component attached to it. Then when you save and load a save file, it will automatically instantiate it from the Resources folder. Another way of doing it (the less preferred way) is having Scene A with the config game object, and Scene B being the actual level. Using this method you can just additively load Scene B, and then load the config save file.

    Thanks, that's a bug that appeared after the recent update I sent you. It happens only when using the new SaveObject method. I'll have to fix that.

    That has to do with the new icon that appears next to SaveableObjects in the editor hierarchy window. I'm not sure why that error exists. I haven't come across it at all, but it seems like something that's easy to fix.

    Sigh. The only reason it gives that error is because that script has "using UnityEditor;" at the top of it, but it doesn't use that namespace at all. Just a simple mistake. If you delete that line, it works. I'll have to take care of that immediately.
     
  25. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    I have fixed the bugs you mentioned. I'll have to reupload it to the Asset Store now. It's already uploaded to my website, so you can redownload it with the info I sent you via PM yesterday.
     
  26. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Cheers for looking into it.

    I am not saving transform component at all. Just my custom component which has a list of class that has a simple public int , float properties. The list is 18 count long, .. so yeah.. something must be wrong..

    Again, I don't mind few kb increases because every tool works differently. But going from 17kb to 500+kb is not exactly... feasible. :D Seems everything is encrypted so I can't open up the file and try to figure out what happened... (like json) Also, it doesn't compress well.. using zip..

    Maybe some.. issues with list being looped over many times.. ?
     
    Last edited: Dec 15, 2014
  27. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Yeah, the file
    Cheers getting it.
     
  28. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    I've checked, but there is no issue with any data being looped over multiple times.

    I think this may just be because of how UniSave stores its data. It does this by storing everything into container classes, and then serializes these classes. This might add some overhead.

    The reason why I went for this approach was because I had ease of use in mind. The underlying Protocol Buffers serializer is contract based, which means you have to decorate your classes with attributes for serialization and deserialization purposes. I wanted to avoid having people to do this, and just make everything work out of the box. These container classes are the ones that are decorated with attributes. They store the values of fields and properties, in addition to the name of their data types. I guess the trade-off is that it adds quite a bit of overhead, which is ironic, because the serializer being used here (protobuf-net, a .NET implementation of Protocol Buffers) is one of the most efficient serializers out there.

    I'm curious though. How did you manage to get up to 500 kb? I just did a simple test by saving a single custom component with an array of ints, and the file size is 9 kb when the array has 18 ints, and 17 kb when it has 100 ints.

    Then I made a prefab that has a component on it that has 3 floats, 2 bools, and 2 strings. I instantiated it 90 times, and then saved it. The file size was 182 kb when only saving the custom component of every instantiated game object. I'll admit, it was 600+ kb when also saving the additional Transform component (which I mentioned adds overhead), but this was on 90 game objects...
     
  29. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Well. I don't know "how" it got to be 500kb , but I can try to send you the save file I made to see if you can analyse it.

    For Transform component issue, it is an issue and maybe not.

    When you build a persistent level with crates and stuffs gets moved around, you have to save the transform component. I can do my own custom check but just by including transform component and it increases lots of overhead is not good.

    I have an idea. Maybe instead of storing all values in the transform component, maybe we can do a much simpler version of it. Not sure what kind of extra data it stores for transform component, but usually.. all we need is position , rotation and maybe a scale value. Which is just 9 vector3 component overall. So instead of storing transform component , maybe user can select optimized custom transform values. We could check this in inspector instead of usual transform component. It could be option as an alternative.

    And..

    Like you have mentioned, it seems like overhead is bit too much.. 100 ints and 17kb ? That alone just sounds a bit too much? Simple math tells me ( I could be wrong ) the data info itself is 4 bytes x 100 = 400 bytes?

    Just how much of "overhead" does it add?

    just to let you know that 500kb was .

    13-14 gameobjects with list of +- 20 elements
    each elements contains

    public int count;
    public float value;
    public float general;
    public bool isEquiped;
    public bool isLocked;
    public string additionalName;
    public string assetPath;

    This is my inventory class.

    When I use Unity Serializer (free plugin) then I get 17kb. UniSave = 500+ kb

    I have around 40 + levels with plenty of these inventory class game objects with it's locations need to save as well.
    If I was to use UniSave, my level data will be bigger than then the level itself, and my game build is sitting around 40mb but my save games will be bigger than that... (each level will have 2+mb sized save games x 40 ???)

    Then.. if I want to do a .. steam cloud sync.. it will be a massive problem as well.

    90 gameobjects with your mentioned data is actually.. nothing.. I can have 100s of gameobjects (crates) with 20+ item containers inside per level. And so far the biggest filesize for my game data is at around 176kb and that is with all other informations such as transform and enemy units as well. If I save that level with UniSave it will be bigger than 5mb..

    No matter how I look at it, ... this clearly needs to improve.

    Think about games like.. touch light. Or Diablo like.. if you make games like that, the levels are being randomly generated with 100s of crates and the save data needs to save those item datas as well as item drops on the ground and enemy information etc... the save game will be huge if UniSave is used. It was just an example, but that is why I said it may work with smaller mobile game or so that doesn't need to save much, but not for any decent sized hack and slash games or RPG that needs persistent game world.

    For your experiment, you said 90 game objects with 3 floats, 2 bools , 2 strings = 182kb. Well, now if that is data for one item in the container slot, you multiply that by the number of items in the container (say 10) then = 1820kb... and that is just 90 gameobjects... I am not saying that every game is like this, but for my game and some other similar games that needs crates to contain persistent data , size will just become too big.
     
    Last edited: Dec 16, 2014
  30. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
  31. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I know Unity Serializer which I am using at the moment :

    https://www.assetstore.unity3d.com/kr/#!/content/3675

    is using zip compression somewhere to reduce size of the save..

    Maybe.. before you do any encryption, run some kind of compression technology first and then encrypt it..
    But maybe you are already doing it? Maybe experiment with no encryption and then zip it to see how small it gets. I tried to zip it but it didn't do much good at the moment. ( perhaps due to encryption) I don't mind small performance hit for saving and loading compressed save files. It is better than to have large sized save files around. And in most cases, if we do compression / decompression in memory, it will save time actually writing to the disk. (And "could" be even faster)

    I keep comparing to it, because UniSave is the closest save game plugin to it and perhaps have potential to carry on its legacy. Unity Serializer has stopped its support some time ago and although it still works, it lacks some forward compatibility ( because it needs to update.. I think it used to work..) and lags behind the latest versions of the Unity.

    The way it works ( for users ) is pretty similar so far , and only downside I can see is this critical file size issue. Otherwise very close to match / better it. UniSave has potential to be the best save game manager for Unity.

    I want to leave a good review for this asset , but holding it a bit more to see if it can actually be used in my game. It's close... but not practical for me yet. I am not nagging just for myself.. This asset truly has potential.
     
    Last edited: Dec 16, 2014
  32. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I have tried loading the stat file just to see if loading is actually working but I get this error :

    UniSave: Non-instantiated GameObject [GameManager] was not found in the scene. Skipping.
    UnityEngine.Debug:LogWarning(Object)
    UniSave.Containers.GameObjectContainer:UnpackContainers(ObjectData) (at Assets/UniSave/Scripts/Containers/GameObjectContainer.cs:166)
    UniSave.<LoadEnumerator>c__IteratorDB:MoveNext() (at Assets/UniSave/Scripts/SaveManager.cs:456)

    Well.. It does exist obviously... and it has saveable object script attached to it too. But it doesn't actually save anything.. It is just a parent game objects to my other game objects which contains inventories.

    There was no switch of the scenes. Just straight load GameStat.dat from the same scene.
     
    Last edited: Dec 16, 2014
  33. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    One thing I noticed is that every time I load the loadgame scene by Unity Editor (not during play) the ID of Saveable Object for GameManager kept changing. Is this normal?
     
  34. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I am not 100% certain if I understood your 2 mentioned work arounds but..

    1. I can't turn my GameManager into prefab and let it instantiate it in another scene, because I have many properties linked to the other managers as well. It will be a disaster to do that.

    2. Second option is probably the only work around, but this also means that I need to keep track of the newly added assets and destroy them when I load another level. Which is not impossible to do , but just lots of potential bugs creeping in by human error and not very ideal when I know if I don't do additive load, it is automatic.

    Sorry about keep bringing up Unity Serializer plugin as an example, but Unity Serializer plugin handles this situation well. It also has savegamemanager like UniSave, just not hidden and both plugin works very similarly in terms of method of using it.
     
    Last edited: Dec 16, 2014
  35. MajinMHT

    MajinMHT

    Joined:
    Mar 22, 2012
    Posts:
    28
    I've done some optimization, and managed to reduce the file size by a huuuge percentage. In one test I did, I managed to reduce the file size from 680 KB to only 2 KB! 99.7% reduction in size :D.

    In case you might find it interesting, I'll tell why the save files were so huge, and the technical story of how I fixed it.

    For this test, I used the following scenario: A prefab with a custom component on it that has 3 ints, 2 bools, and 2 strings. I told UniSave to save both its Transform and its custom component. I instantiated it 90 times.

    So first, I switched off encryption just so I could read the save file and check out what was going on. I realised that UniSave stored a lot of unnecessary duplicate metadata. This metadata includes:

    - Names of data types of the saved fields and properties
    - Names of the fields and properties
    - Names of the game objects
    - Values

    This data is needed by UniSave so it can properly reconstruct things, but the problem was that it would save this data for every property/field/game object/component. So for example, if you saved 30 fields that were all strings, it would save the full name of their data types 30 times as well. In addition, it would also save the name of all these fields, despite the fact that some of these fields could have the same name, resulting in duplicate metadata.

    What I did, is I made a list for each of the aforementioned types of metadata. These lists make sure they don't have duplicate data. Whenever a field or property gets saved and is of a certain type, the name of that type gets added to a list, and can only be added once. Every saved field then gets assigned a number, and this number is the index of its type in the list. The same concept applies to all the other types of metadata. Lists with unique data, and objects that refer to it by index.

    After I made this change, the file size was reduced from 680 KB to 81 KB. That's a size reduction of 88%.

    I was quite happy with that, but I wanted to go further. I thought let's go all the way. There's a still a bit of overhead, but to get rid of that would require me to redesign UniSave's container classes. That's not something I'm going to do. Then I decided to look for a compression method, and found one, but I wasted time with it because it didn't work. Finally, I decided to use FastZip, from the SharpZipLib library. This creates an archive file, and adds the save files to it. At first, this didn't really make the file any smaller. Then I found out that this is because of the encryption (AES) that UniSave used to encrypt the save files. (You mentioned earlier that zipping the files didn't help, now you know why) I removed this file encryption method, and now the compression worked and this reduced the file size from 81 KB to 2 KB. That's a further 98% reduction in size.

    I've uploaded a new version that contains these optimizations. (v2.1.1)


    I also want to point out it could take a relatively long time for any future updates to be released from now on. Due to personal reasons, it's currently not possible for me to spend much (or any) time on it, so please keep that in mind.
     
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    It is great to know that size issue has been solved! Wow! nice one!

    I can understand that you may not be able to update the UniSave often as you like, we all have our own personal reasons. But.. You got to at least make sure that things do.... work..( to some degree ) Not asking any new "features" here.. but at current state it is not even usable...

    Ok, then What about this loading issue?
    UniSave: Non-instantiated GameObject [GameManager] was not found in the scene. Skipping.
    I am not sure why... The GameObject ( GameManager ) does exist... is it because of my mentioned issue of ID being renewed every time it loads the level? My little logic tells me.. that ID , once it is assigned, should not really change? if it does change all the time, how does saved game know what to match?

    It could be that I am not using the tool properly or it could be a simple bug.

    Also..

    I have just downloaded the latest version and tried it.

    SaveObject actually does.. nothing.. it doesn't give any log or error.. just does nothing.
    But when I used SaveScene. It did work. So it means, my setting is ok..

    SaveObject("GameStat.dat",GameManager); => Nothing.
    SaveScene("GameStat.dat"); => Works.

    For test I have only put the saveable Object scripts to the GameManager object tree.

    (And file size were indeed really really small..even a lot smaller than the Unity Serializer.. but I will have to be able to load it and see if it indeed working )
     
    Last edited: Dec 18, 2014
  37. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I have sent into Saveable Object script and enabled couple of debug comments and I can see that it gives me :

    "Duplicate GameObject found, Generating new ID: " log...

    Which means it doesn't think the saveable object script component is the same as the one in the manager.. humm..

    -------------

    I have tracked it down to the following :

    I made _SaveableObject Manager not hidden and found out that every time I load level, it creates a new one!

    So I tracked down the code which is creating it.. but the code does looks ok to me... very strange.

    ------------

    Ok, well, I did some more debugging and it seems like Awake function which calls Init , but it can't find the _SaveableObject Manager ! (null returned) But ofcourse it does exist.. so it creates a new one.. again .. again.. every time scene is loaded in the editor.

    So ... this

    var manager = GameObject.Find("_SaveableObject Manager");

    returns null, even if _SaveableObject Manager actually exist... How is this possible.. I am scratching my head.. here..


    -----------

    Did more experiment..

    I made fresh scene with a single game object and then added saveable object component, saved.. loaded.. ID the same ! so I thought at least this is working...

    Then back to other scene, this time dragged a prefab from project into scene. Added saveable object component, saved. loaded.. ID not the same! And multiple saveable object managers!

    Not sure what.. but maybe it is how Unity instantiates prefabed objects first and then execute its awake before anything else?

    ------------

    And more..

    In case with very simple scene, I dragged non prefab gameobject (which has saveable object component attached to it) to project to create prefab. (so the it is now prefab) Suddenly, I have 2 saveable object managers and ID of object is gone. ( Does not display in the inspector)
     
    Last edited: Dec 18, 2014
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I am also going to have to try your work around of additive loading of my level scene. But would not that then also load save object manager from level scene into my main scene? There will be 2 of them then?
     
  39. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Majin. I know you said you will be busy, but can you at least try and make the plugin to actually "work" ? Are you in leave for Christmas holiday? Can you let us know of your availability? We can't just hold on to something like this not knowing when it will be able to use it.
     
  40. LadyAth

    LadyAth

    Joined:
    Jan 17, 2014
    Posts:
    158
    @castor76: Maybe give him a bit more time to look into your concerns? He's been very responsive to your issues so far and I've been watching the updates on this asset for a while now. Your comment to 'make the plugin to actually work' is not a fair one. :p
     
  41. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I am willing to give him a bit of time, but the plugin is not usable at the moment, and I need to know of update plan, schedule so that I can plan accordingly. I may be pushing him a bit but waiting with unknown schedule is very difficult.
     
  42. aaronhm77

    aaronhm77

    Joined:
    Nov 22, 2012
    Posts:
    65
    thatnk you for reply;

    i will purchase unisave then

    and ask for the money back on easy save which is a deliberate rip off and no one is saying anything about it.
     
  43. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I know it is around the end of the year.. and maybe Majin is still very busy. But can he not let us know when he will be back?
     
  44. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Sop....

    I wonder when we will be able to hear from Majin again...
     
  45. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Still no news from Majin.... Has he gone somewhere? Has he abandoned the plugin? When will he be back?
     
  46. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I am getting :

    An error occured while checking for updates for UniSave. The latest version number could not be retrieved.
    UnityEngine.Debug:LogError(Object)
    Asset09de50f151c747568d38c51973deaf13.AssetUpdateChecker:GetXml(String)
    Asset09de50f151c747568d38c51973deaf13.AssetUpdateChecker:.cctor()
    UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[])

    Maybe UniSave is shutdown?

    https://www.majinmht.com/

    is down also
     
  47. BuckeyeStudios

    BuckeyeStudios

    Joined:
    Oct 24, 2013
    Posts:
    104
    has anyone made a ngui panel(s) for this
     
  48. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Not sure what is happening, but Majin is missing, his website is down but asset store updated with version 2.1.1 on 2nd of Jan 2015.

    Just what is going on here... Also the price has gone down to 10$...

    Not adding a new feature is one thing, but not being able to use it is another..

    Load bugs, multiple savable object manager... garhh...
     
  49. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Hi i thought i would try this and give it a go but when i import it i get this error CS0246: The type or namespace name `SerializationHandler' could not be found. Are you missing a using directive or an assembly reference? anyone know why ?
     
  50. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Shaun.

    Author has gone missing for this plugin and I have no idea what's happening with the support. Website is also down seems to indicate that "something" has gone wrong.. I am too waiting for author so I can actually make the plugin to function properly.
     
    thenamesace likes this.