ISerializationCallbackReceiver and EasySave

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
porters25
Posts: 11
Joined: Sun May 01, 2016 12:28 pm

ISerializationCallbackReceiver and EasySave

Post by porters25 »

Hi Joel,

I have a base class with a Dictionary field I would like serialize using Unity's serializer. In order to do this I was going to implement unity's ISerializationCallbackReceiver interface and perform the necessarily actions to serialize/deserialize the dictionary (https://docs.unity3d.com/ScriptReferenc ... eiver.html). The reason I am using Unity's serialization for this dictionary is that I have a situation where the dictionaries values will need to be modified via the Unity editor at design time, and I would like these changes to be persistent (in actual fact the class the derives from the base class with the dictionary I want to serialize will belong to a ScriptableObject that will be modified via a custom editor window).

The above is a very specific case, and generally, classes that derive from the base class will not be modified outside of runtime and won't require Unity serialization. These other classes that are not modified outside of run-time will be serialized/deserialized using Easy Save. I'm not sure how Easy Save works behind the scenes exactly, so I was concerned that if i were to implement the ISerializationCallbackReceiver interface in my base class, that may interfere with Easy Save's serialization of the other classes that derive from this base class? Can you implement Unity's ISerializationCallbackReceiver interface in a class and still safely use Easy Save to serialize/deserialize the same class?

Thanks Joel.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ISerializationCallbackReceiver and EasySave

Post by Joel »

Hi there,

As ISerializationCallbackReceiver shouldnt be called by Unity at runtime, it should have no affect on Easy Save.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
porters25
Posts: 11
Joined: Sun May 01, 2016 12:28 pm

Re: ISerializationCallbackReceiver and EasySave

Post by porters25 »

Awesome.

Thanks Joel!
Locked