[Feature Request] Serialize some fields via ISerializationCallbackReceiver like how is it done in OdinSerializer
Hi, there seems to be a problem with displaying the enum name in the SaintsDictionary.
public SaintsDictionary<CollectableType, Color> Colors;
public enum CollectableType
{
None = 0,
Missile = 1,
Coin = 2,
Shield = 3,
}
Ui toolkit
Staints 4.13.0
Unity 2022.3.57f1
One more question: why not serialize the System.Collections.Generic.Dictionary via ISerializationCallbackReceiver how is it done in OdinSerializer?
Thanks for this reporting!
This is fixed in dev branch. Will release it tomorrow :)
Thanks for your labour! The issue of ISerializationCallbackReceiver is still relevant. I think this will get rid of your Data types, yes, it will require some kind of abstract class, similar to saintsMonoBehaviour and saintsScriptableObject, but it may even be a plus, in case of conflicts with other solutions, and will allow the user to choose.
Hi,
ISerializationCallbackReceiver will not be considered for the following reasons:
- Unity itself still has some bugs in serialization. With years of Unity game developing, I sometime still face the issue that something is missing, broken, or Unity failed to refresh a target.
- Odin (Odin Serializer), based on my previous experience, has an issue with serialization
Dictionary<T, enumFlagType>. I didn't find anyone mentioning it on the internet; it only happens in one simple script of mine, and I have never found a solution SaintsFieldis still heavily focused on portable types & attributes, which means most data types & attributes should work either fine or good enough (e.g., without SaintsEditor, all auto getters work just fine, but they will require you to click on that+button on a list/array)- An IDE like Rider can not detect a custom
MonoBehaviorserializable dictionary
A ISerializationCallbackReceiver adds way too much complexity, and it will be a pain to locate a bug, even to see if it's related to this function.
Hi, thanks for the efficiency. I still don't like the idea of custom serializable standard types. Well, maybe I'll integrating odin serializer with saintsField in my project. If it succeeds, I will let you know.
Im re-considering this feature because ISerializationCallbackReceiver should solve many problems, including #289
Added in 5.5.3