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

Unity Save Game / Level Serialization

Discussion in 'Assets and Asset Store' started by whydoidoit, Jun 5, 2012.

  1. Zozo2099

    Zozo2099

    Joined:
    Jul 15, 2012
    Posts:
    478
    A quick question, is it fully compatible with Unity 4? thanks!
     
  2. whydoidoit

    whydoidoit

    Joined:
    Mar 12, 2012
    Posts:
    365
    Yes it is :)
     
  3. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    680
    +5 votes
    You can vote here: http://feedback.unity3d.com/unity/all-categories/1/hot/active/scripting-save--load-in-game

    Question for Mike or anyone else smarter than me:

    I want to use this to save settings in game, like health, lives etc.. (datatypes: int, string, dictionary, boolean) I have empty gameobject with one script (dont destroy on load) that holds all the info. I found something from docs that i can save only one object, right? Edit: i actually ment i can ALSO save just a single gameobject. But as far as i remember, there was a note i should not use dont destroy on load when using UnitySerializer, correct?

    Is UnitySerializer good for this kind of thing?
     
    Last edited: Feb 12, 2013
  4. ashenvale

    ashenvale

    Joined:
    Aug 28, 2012
    Posts:
    7
    The tag from a game object doesn't get restored when it is saved using LevelSerializer.SaveObjectTree(globalGameObject).

    All game objects and children gets restored correctly but the tag from the root node does not get restored at all. Am I doing something wrong here?
     
  5. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hey Mike, not sure which one to post this (u have 3 threads here :D) anyway - when I started a new project and noticed I now have FOUR Unity Serializer packages by default when I am starting a project - so I went to the directory where Asset Store store the packages and found there are 4 Unity Serializer packages there :

    Save Game-JSONBinary.unitypackage
    Save Game-JSON Binary.unitypackage
    Save Game-Unity Serializer.unitypackage
    Unity Serializer - Save Game.unitypackage


    I am just wondering does Unity Serializer need all those packages to work? :D
    Can I delete some of them? I am guessing only one of them is required?
     
  6. Daedin

    Daedin

    Joined:
    Dec 28, 2012
    Posts:
    3
    Hi Mike,

    This actually looks awesome.
    I get issues when loading the game though, most likely caused by the FSM. Is it supposed to work with the Finite State Machine you detail in unitygems?
     
  7. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    I don't use UnitySerializer to save that sort of settings object, but as far as I recall it is only the SaveGameManager that shouldn't be (on) a GameObject that has DontDestroyOnLoad set... I haven't used it for any object with DontDestroyOnLoad though, so don't quote me on this :)
     
  8. Foram

    Foram

    Joined:
    Apr 5, 2013
    Posts:
    12
  9. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    Hi Mike.

    I've just imported the package into my project.

    The first thing I've noticed is the usage of the old gameObject.active in a bunch of places. There is also a call to the obsolete SetActiveRecursively inside Radical.cs

    Are you planing on making a new version compatible with Unity 4's usage of the new functions?

    Another error I have encountered is with the new Mechanim Animator Component, where the Avatar field is never correctly deserialized, and is null on load.
    Is there a way around it with your current system?
     
  10. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    387
    Trying to a very simple iOS save on quit and load on start, but it is going in to a loop loading the game every frame. I have a save game manager sitting on it own object nothing else done to it. I have GameLoader object with on script on it. and currently no objects marked with store information (trying minimal case) yet it loops as if my gameloader object is being loaded and started even though it is not marked for saving. the code ode on it is

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GameLoader : MonoBehaviour {
    5.    
    6.  
    7.     // Update is called once per frame
    8.     void Start () {
    9.         //PlayerPrefs.DeleteAll();
    10.         if(LevelSerializer.SavedGames.Count > 0) {
    11.                 Debug.Log (LevelSerializer.SavedGames.Count);
    12.                 LevelSerializer.SavedGames[LevelSerializer.PlayerName][0].Load();
    13.         }
    14.        
    15.     }
    16.    
    17.     public void OnApplicationQuit(){
    18.         LevelSerializer.SaveGame("Game");
    19.     }
    20.  
    21. }
    22.  
    what is the correct way to make a simple save on quit and load on start for iOS?
     
  11. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312
    Hey Mike Talbot, Question :

    Can your serializer save state in-game, and then load that state after reopening the game? If yes, can you explain it to me how to do that, im a noob when it comes serialization related stuff, if no, is there a way i can save the information to a XML file and then load it in-game?
     
  12. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    That is the point to this package - to save games so you can restore them.

    I assume that this is documented either in the package or on his website.
     
  13. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi whydoidoit, I would like to use your plugin but getting some problems.

    First is you plugin compatible with pool manager by path o logical? I only want to save my rigid body coin prefabs but when I save and then load every prefab i have in pool manager is getting spawned at the center.

    I have a coin pusher game and I like to save the board (coins and goodies prefabs) so that the player can resume his game exactly where they have left.

    Cheers, Roy
     
  14. Riagan

    Riagan

    Joined:
    Feb 11, 2013
    Posts:
    7
    So I have a weird issue that I can't seem to figure out... When I import the serializer into my game it is somehow affecting animations. Namely, the animations I am using for prototyping that come with the "constructor" model (ie. idle, walk, run...). It changes all of the animations to just one animation called "Take 001". I have tried reimporting both assets and that doesn't seem to work. Does anyone know what is going on here?
     
  15. Riagan

    Riagan

    Joined:
    Feb 11, 2013
    Posts:
    7
    I should clarify: I fixed the clips, but I don't understand why this happened...
     
  16. Cogent

    Cogent

    Joined:
    May 14, 2013
    Posts:
    356
    First of all I'd like to say thanks for your work on this Mike and for choosing the MIT license for UnitySerializer.


    Just need a bit of clarification on the license(s)... :D

    Does the SharpZip GPL affect the UnitySerializer license or does the special exception below
    exempt us from the GPL?

    We've read it but you can't be too careful with the GPL.

    "Linking this library statically or dynamically with other modules is
    making a combined work based on this library. Thus, the terms and
    conditions of the GNU General Public License cover the whole
    combination.

    As a special exception, the copyright holders of this library give you
    permission to link this library with independent modules to produce an
    executable, regardless of the license terms of these independent
    modules, and to copy and distribute the resulting executable under
    terms of your choice, provided that you also meet, for each linked
    independent module, the terms and conditions of the license of that
    module. An independent module is a module which is not derived from
    or based on this library. If you modify this library, you may extend
    this exception to your version of the library, but you are not
    obligated to do so. If you do not wish to do so, delete this
    exception statement from your version."



    EDIT: would it be sufficient to just set useCompression = false in LevelSerializer.cs ?


    Thanks in advance.

    Cheers
     
    Last edited: Jul 28, 2013
  17. whydoidoit

    whydoidoit

    Joined:
    Mar 12, 2012
    Posts:
    365
    I believe that the exception covers the issue - and turning off compression will certainly disable SharpZIP which is just included at the end of the process to reduce the size of the resulting byte array.

    That is certainly my understanding anyway - but as you say, not being a lawyer can make this a minefield.
     
  18. Purpleshine84

    Purpleshine84

    Joined:
    Apr 8, 2013
    Posts:
    194
    We cant seem to let it work with Mecanim sadly, we can save the game but if we load it, the framerate is horrible and everything gets stuck.
     
  19. Reekdeb

    Reekdeb

    Joined:
    Nov 26, 2012
    Posts:
    9
    Hi whydoidoit, after updating from unity 4.2 to unity 4.3 undo is not working in unity serializer window. :sad: Can you please update it?
    Thank you, for this awesome asset.
     
  20. SnowF1ake

    SnowF1ake

    Joined:
    Jan 3, 2014
    Posts:
    1
    I can't believe you're giving me this for free. You're the best :)
     
  21. Big-Black

    Big-Black

    Joined:
    Aug 29, 2013
    Posts:
    9
    Hi the assets is overall great but, its not compiling on WP8. Is there any solution for this ?
     
  22. SirMarley

    SirMarley

    Joined:
    Jul 26, 2014
    Posts:
    115
    Hey Mike. I have had a problem after resuming my game from a checkpoint. I receive an "error" saying
    Animator has not been initialized.
    UnityEngine.Animator:SetInteger(String, Int32)
    And, therefore, no animations are working (my player, a Spaceship, is controlled all the time from an animator, so after resuming, it is invisible)

    Also, if you can tell me how can I delete a checkpoint from script, if I have to, whould be perfect.

    Thanks a lot!
     
  23. Aedous

    Aedous

    Joined:
    Jun 20, 2009
    Posts:
    244
    Don't know if this helps anyone, but if you are using the plugin and you click on the Room's tab it gives you a unity error. Investigated a little bit and there was an off closing bracket.
    The error is in the file UnitySerializerWindow.cs on line 692 'GUILayout.EndVertical()'.
    The closing bracket on line 639, is what is causing the error, so I moved it to line 693 after 'GUILayout.EndVertical()' to fix the problem, hope this doesn't break anything and helps anyone having the same problem.
     
  24. PandawanFr

    PandawanFr

    Joined:
    Nov 27, 2013
    Posts:
    68
    Doesn't work on Unity 5... ;(
     
  25. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    The Unity Serializer project hasn't been updated in forever. I don't expect the author will port to 5. I would look elsewhere for a serialization option.
     
    Bruno2Silva2 and chelnok like this.
  26. PandawanFr

    PandawanFr

    Joined:
    Nov 27, 2013
    Posts:
    68
    Ok, thank you!
     
  27. DarkStoorM

    DarkStoorM

    Joined:
    Feb 25, 2015
    Posts:
    2
    Is it still available? The website contains only the clickbait advertisement links... or I just missed something.
     
  28. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    It has been nearly a year since the last post from the author, and - yes - the original website does seem to have lapsed.
     
    Bruno2Silva2 likes this.
  29. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    we will try to fix system bugs to work then in unity 5
    I kind of solve a small part of the problem
    With the initial error when importing the asset simply deletes the folder of the two scripts that deal with caring for meshes (excuse me for my translation am Brazilian and I speak basic English)
     
  30. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    Last edited by a moderator: Oct 26, 2015
  31. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    @Bruno2Silva2 What are the files that should not be imported? Your image is not being displayed.

    Also, Can this (the asset store version) be used to instantiate replacement pieces from placeholders, for example load a wall in the place a line (wall placeholder) was placed in a game editor?
     
    Bruno2Silva2 likes this.
  32. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Here's a screenshot of the image:
    781dabd70737d07ce8c41e3aa4e46647.png
     
    Bruno2Silva2 likes this.
  33. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    Not notice my lack of knowledge in this epoch I was not very good :oops:, now I can say I know a lot :)... Let's say I tripled my knowledge
    sorry for the translation
    :oops:
     
  34. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    I am getting a few errors even after removing these scrpts.

    Assets/Plugins/whydoidoit.com/Serialization/UnitySerializationExtensions.cs(770,32): error CS0246: The type or namespace name `ClothRenderer' could not be found. Are you missing a using directive or an assembly reference?

    Assets/Plugins/whydoidoit.com/Serialization/UnitySerializationExtensions.cs(770,2): error CS1502: The best overloaded method match for `ComponentSerializerFor.ComponentSerializerFor(System.Type)' has some invalid arguments


    Assets/Plugins/whydoidoit.com/Serialization/UnitySerializationExtensions.cs(770,2): error CS1503: Argument `#1' cannot convert `object' expression to type `System.Type'

    I think these are Unity 5 incompatibility problems but not sure, I don't want to simply remove the line as last time I did that I ended up with more errors.
     
  35. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    These look like unity 5 changes. In the very least, I know that cloth had changed significantly in the underlying physx code used by unity.
     
  36. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    Last edited: Oct 27, 2015
  37. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    I am willing to pay for anyone who can modify the asset to work without Linq usage so that it can work well on AOT environment such as XboxOne console. please get in touch ! saehoon@pixellore.com