Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[Solution] Convert serialized prefabs and scenes from 5.5 to previous unity versions

Discussion in 'Editor & General Support' started by Seneral, Mar 20, 2017.

  1. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    Hey everyone,

    While getting ready for AS submission I noticed all prefabs and scenes serialized in 5.5 (my development version) were completely broken in my minimum target version, 5.1.5.
    While the automatic conversion of Unity from 5.5 to 5.3+ yielded working results, all object names were gone - porting to < 5.3 even resulted in completely broken prefabs and scenes :(
    Of course I'm aware Unity had no intention to make this work in the first place but I'm sure many people would appreciate backwards compability:)

    So I wrote a little script that works on the text-serialized versions and 'converts' them to work in previous unity versions based on some basic text processing - it is really surprising how these simple modifications do wonders:)
    It can be found on Github Gist along with my other small projects.

    To convert serialized files (prefabs, scenes, ...) to versions <5.5 or <5.3:
    1. Get my script from Github Gist
    2. Enable force text serialization in ProjectSettings/Editor
    3. Right click on the asset in the version it was serialized in and select the target version
    4. Move the created file with the _Converted suffix into the target project

    It is currently pretty simple and rough as I was in a hurry, if there's interest I can add batch processing and other improvements:)
    Seneral
     
    Arkade and jdraper3 like this.
  2. Gerold_Meisinger

    Gerold_Meisinger

    Joined:
    Sep 8, 2015
    Posts:
    93
    Thanks for the script, unfortunately it didn't work for a asset we bought from the store (submitted using Unity 5.5.0). I set serialization to force text and deleted the library folder, temp folder, .meta files, .sln/proj files and disabled Cache server but Unity 5.3.7f1 always crashes upon opening the converted scene file.

    You should also sell your script on the asset store I think.

    Btw if you want to assure backwards compatibility we used to develop a project in the lower Unity version (4.6 in our case) and pull the changes into a branch which was upgraded to a higher version (5.3 in our case). Upward conversion should always work. We only had to worry about plugins and their Unity compatibility.
     
    Last edited: Mar 28, 2017
  3. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    Hey,
    I won't sell such a small little script, I think such utilities should stay free. Don't know, just feels inapropriate:) Also I created it for my needs without a guarantee it is working in every case.

    Yes I now do develop in my target version but when I started I did not consider this. Usually, you should have backup incase you're upgrading your project to a newer version or similar but, there should atleast be the possibility to downgrade.

    If you're allowed, can you PM me the scene file? I just filtered the differences between the scene files but there are probably edge cases where things are differently - especially in scene files.
    Also, you should just be able to right click/Reimport with force text serialization on and then open the file in a text editor and see text - correct? Just to make sure it's really serialized as text.

    Seneral
     
  4. Gerold_Meisinger

    Gerold_Meisinger

    Joined:
    Sep 8, 2015
    Posts:
    93
    Well, I was more thinking about visibility and update management and stuff like that. I sent you the file.