How to save entire scene?

I have simulation game.
There is not much movement, but have my custom classes and data need to be saved, and also UI too.

I want entire scene save feature.

Are there good solution?

I have tried this,

but it does not work perfectly at unity 5.5.0b11 newest beta version.

Couldn’t you instead of saving the entire scene just save the changes made to that scene into a XML file or other type of storage and then load the changes into the scene? If this is an option for you I think this would be useful resource. Failing that I guess you could write a serializer for scenes or try and find one online. However I would strongly suggest saving the games “state” instead of the entire scene.

I have script object that has 12 scripts on it.

I need those 12 script’s whole variables, datas.

Is that solution can instantly save these?

Yes you can use this method to save all of your variables.

I wrote a save and load solution and uploaded it for everyone, maybe it will prove useful to you. You can save and load single gameobjects or eeven components, or a whole scene. It’s easy to understand and well-documented, but also very flexible.

1 Like

its really heavily based on your use case. They way i would approach have everything i need to be serializable inherit from a common class, or implement a certain interface, and use the JsonUtility in unity to write the data out to a json file on save.

The problem when it comes to using serialization in Unity is that Unity’s various Types can’t be serialized directly and will throw errors; That’s why you have to find workarounds, such as using substitute classes that use simple Types, or use SerializationSurrogates, or replicate the data structure into a serializeable form, or a combination of those (which is what I did).

put it to DONTDEDSTROYONLOAD and save it