docs.unity3d.com

    About Unity Runtime Scene Serialization

    Use Runtime Scene Serialization to save and load scenes in Unity Player builds.

    To test this functionality in the Editor, try opening a scene and going to File > Save JSON Scene.... Make a new scene, then Choose File > Open JSON Scene... choose the scene you just saved, and you should see the same objects as if you had opened the Unity scene.

    To use this in your project, simply call SceneSerialization.SerializeScene on the currently loaded scene you would like to serialize, and call SceneSerialization.DeserializeScene to parse a JSON scene and create the objects within.

    This package includes ILPostProcessor implementations which generate code in order to visit properties for any type on IL2CPP without using reflection. This process can add a significant amount of time to IL2CPP builds, and will increase the build size by a small amount. Both of these effects scale up with the number of serializable types in your project. You can customize this process by going to Edit > Project Settings... > Runtime Scene Serialization. By default, the system will not generate property bags (needed for visitation) for any assemblies in your project. You need to enable each an assembly as needed for serialization to work in IL2CPP builds. Within each assembly, you can disable a namespace or individual type by toggling the checkbox in the right column. Note that disabling a namespace in one assembly will exclude types in another assembly that belong to that namespace.

    Installation

    To install this package, follow the instructions in the Package Manager documentation.

    Requirements

    This version of Runtime Scene Serialization is compatible with the following versions of the Unity Editor:

    • 2019.3 and later (recommended)

    Known limitations

    Runtime Scene Serialization version 0.2.3-preview includes the following known limitations:

    • Some properties like LightMap settings on renderers are not accessible from C# and cannot be serialized with this package
    • There may be some interference with DOTS serialization because of the types of property bags generated by this package
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023