Search Unity

[Searching testers] unityserializer-ng: A complete saving solution for Unity 5

Discussion in 'Unity 5 Pre-order Beta' started by TheSniperFan, Jan 4, 2015.

  1. TheSniperFan

    TheSniperFan

    Joined:
    Jul 18, 2013
    Posts:
    700
    What is unityserializer-ng?
    Mike's Unity Serializer is an excellent asset for Unity. It's powerful, flexible and convenient. However, it's unsupported and has been for quite a while now.
    The Unity 5 beta was the straw that finally broke the camel's neck: It stopped working.
    As far as I am aware, the original developer hasn't been active since 2013. Considering that this asset is a) extremely good and b) used in the game I develop at the moment, I decided to adopt his project.

    unityserializer-ng is my fork of Unity Serializer. The goal is to fix and extend this asset for use with Unity 5. The name-change was made to prevent confusion. My fork is not backwards compatible due to some fundamental changes. Besides that, I don't support Unity 4. Considering that the original asset is still available and working, this is my best chance to remove legacy-bloat.


    How much is it?
    I can get behind that idea. As such, my fork is FOSS - Free and Open Source Software - and released under the MIT license.
    I don't charge for it. I won't charge for it.



    How to use it?
    Refer to the Unity Serializer website for tutorials on how to use it. I've been busy developing and haven't gotten around writing tutorials, documentation, etc. yet; There's still so much to do.
    After that, here's some important differences between Unity Serializer and unityserialzer-ng:

    • Avoid coroutines whenever possible. US already had resumable coroutine support (which was partially broken btw.). However, coroutines have some dodgy behaviour that cannot be fixed. In future, I will write a tutorial on how to avoid some of the problems. For now: Avoid them, if possible. Okay scratch that. As far as I am aware, coroutines are always avoidable.
    • Be careful when serializing the new GUI components. I don't know why you'd want to do that in the first place, but you can do that now. Changes to the events are not stored automatically. You'd have to do that yourself with OnDeserialized().
    • The savefiles aren't stored in PlayerPrefs anymore. Instead I developed a drop-in replacement called 'FilePrefs'. The idea was to prevent PlayerPrefs from writing to the Registry on Windows. Working with registry keys is a royal pain in the ass and has no benefits over using files. The files are stored in "$Application.PersistentDataPath/persistentData/default/". In future, this asset will be its own project, since it's easy to add more datatypes for saving and it has profile support built-in.
    • When serializing MeshColliders, the isTrigger and convex properties behave weird. Make sure that there are no problems while saving, then everything should be fine.
    • The Room Manager has been disabled. Clicking the "Rooms" button in the wizard crashed the editor. I'll look into it at some later stage of development. Fixed. Just use the wizard to create a new Room Manager Object.
    That is all for now.


    How to help?
    I'm posting this here, so I can make this asset be ready once Unity 5 stable hits. I need your help for that though.

    Request Features : Good
    Report bugs : Better
    Contribute : I love you


    Where to get it?
    I attached a copy here. I'll update it from time to time. For the most recent code, go to the project's GitHub repository.

    Warning: If you downloaded the old version, be sure to delete the "Plugins/whydoidoit.com" and "Plugins/Editor/whydoidoit.com" folders first.

    unityserializer-ng (Last updated: 21.01.2015)
     
    Last edited: Jan 21, 2015
    kinnik, sluice and Joviex like this.
  2. TheSniperFan

    TheSniperFan

    Joined:
    Jul 18, 2013
    Posts:
    700
    Just updated the asset and fixed the Room Manager tab of the wizard. The updated version ships with the Room Manager enabled again and comes with Examples (which I forgot to include last time).

    Bear in mind that the examples are really, really old and also partially broken. It's no problem though, because the only really important script (PauseMenu.js) works flawlessly. Just add it to your scene in order to test the saving functionality.
    Creating updated examples is next on my agenda.
     
    Joviex likes this.
  3. Leafblighter

    Leafblighter

    Joined:
    Oct 28, 2014
    Posts:
    3
    Hi SniperFan,

    Thanks for taking this project over. I just imported your newest version and am receiving this error before I even touch anything:

    Assets/Plugins/OpenUnityTools/unityserializer-ng/Serialization/UnitySerializationExtensions.cs(807,38): error CS0234: The type or namespace name `ShadowCastingMode' does not exist in the namespace `UnityEngine.Rendering'. Are you missing an assembly reference?

    I am using Unity 4.6.1


    Thanks,
    Mike
     
  4. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    837
    unityserializer ng is for unity 5 only, you should use the original unityserializer.
     
    TheSniperFan likes this.
  5. TheSniperFan

    TheSniperFan

    Joined:
    Jul 18, 2013
    Posts:
    700
    @Leafblighter As @Carpe Denius said, this asset is Unity 5 only. However, I already had it forked by someone who fixed it up for Unity 4. Here you go.

    I just updated the package in to contain the latest code. The biggest changes are:
    1. New, Unity 5 ready examples
    2. No more JSON support (more on this decision here)
    3. Improved compression of saved data
    Developed, tested and packaged with Beta 20.
     
  6. Adrenesis

    Adrenesis

    Joined:
    Feb 22, 2015
    Posts:
    7
    Hey guys,

    Sorry to bring that subject there, but on the internet it looks like the most appropriate place.

    First of all, big thank to whydoidoit, TheSniperFan and brainz80, you guys are Awesome!

    I am trying to run the brainz80's version on the 4.6.2f1. Only one script uses one function which is obsolete (again).

    Error:
    Assets/Plugins/Editor/OpenUnityTools/unityserializer-ng/UnitySerializerWindow.cs(332,42): warning CS0618: `UnityEditor.Undo.RegisterSceneUndo(string)' is obsolete: `Use DestroyObjectImmediate, RegisterCreatedObjectUndo or RegisterUndo instead.'

    Line of code using that function:
    Undo.RegisterSceneUndo("Change Identifiers");

    Any kind of way to get rid of it?

    Thanks in advance, thanks for your work, and sorry again to necro your topic =)
     
  7. TheSniperFan

    TheSniperFan

    Joined:
    Jul 18, 2013
    Posts:
    700
    @Adrenesis :
    It's just a warning, so you can safely ignore it.
    I don't feel like rewriting it now, because there are 21 warnings and I don't have much time on my hand. What little time I have, I'd rather spend on playing games and working on mine (two things I haven't really gotten to in weeks).
     
  8. Adrenesis

    Adrenesis

    Joined:
    Feb 22, 2015
    Posts:
    7
    @TheSniperFan
    Do you mean that in Unity you can use an obsolete function?

    I don't ask you to rewrite it, the work you did put on it is already awesome. =)

    what's the best choice?
    1) Wait for Unity 5 free
    2) Use it like that
    3) Downgrade my Unity

    I'm still beginner with Unity, even if I did handle some big projects on GameMaker. We are reworking our project which was on Game Maker and start back from 0 with a new programer. I get a lot of things about Unity, but as our projet is close to a modern roguelike, I feel it would be better to go with UnitySerializer. =)
     
  9. TheSniperFan

    TheSniperFan

    Joined:
    Jul 18, 2013
    Posts:
    700
    Just like with programming outside of Unity, there are warnings and errors.

    Errors mean your code is broken => Cannot compile ("You called function x, but there is no function x!")

    Warnings mean that there's something you *might* should have a look at => Code still works ("You created a variable there, but it seems you aren't using it anywhere.")

    There are various reasons why functions are being marked obsolete (performance, stability,...). It just means that there are better alternatives now, not that you necessarily need to use them (just yet).


    As for what to do:
    Unity 5 has RCs (release canidates) already, so the first stable release is probably not that far away. Unity 5 comes with an automatic API updater that updates your Unity 4 code to Unity 5 automatically.
    I recommend you to just stick with the latest Unity 4 and brainz80's fork for now. Once U5 hits shelves, you can update your code and replace his fork with mine.
     
  10. Adrenesis

    Adrenesis

    Joined:
    Feb 22, 2015
    Posts:
    7
    Thank you for these information. Don't worry, I know the difference between warning and error, I learned to code 6 years ago =). But, in Game Maker(in GML script), an obsolete function = you can't even compile.

    So, yeah, thank you for all these informations. =)
     
unityunity