1
\$\begingroup\$

I'm working on an editor where one important feature is to save and load changes (all type of changes like adding and removing objects and their components and components property values)

I want to know there isn't a Unity solution for that and I have to make a data format to save all of them on a string and load all of them? As I searched there is class serialization solutions that works like I said and has its own difficulties. Is there any thing or asset that performs all of this simply?

\$\endgroup\$
0

1 Answer 1

3
\$\begingroup\$

I believe you are talking about serializing MonoBehaviours. This is something we have struggled with since the dawn of humankind.

There are third party tools available on the asset store, but they each have their own limitations and learning curves.

You can write your own tool using reflection, but considering what a strong desire there is for a tool that does this, I am guessing the third party assets have already done an amazing job with the restrictions they have.

I suggest you save the individual aspects you need to, one at a time. It's less elegant than serializing and saving an entire MonoBehaviour, but it's what I have chosen to do after days of my own research into the matter.

There are several ways to save an individual field. First you must make sure it is serialized, and then you can save. There are many resources available on how to save a single field. (EasySave2 (paid) is my personal preference.)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Indeed. You need to write a serializer for your gameobjects. In most cases you could simply store the transform position, rotation and scale. But again, the data required to save a scene state is completely depending on your gameobjects. And the format you store it in, is up to you. You still need to write the deserializer as well. \$\endgroup\$
    – jgallant
    Commented May 11, 2017 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .