ISerializationCallbackReceiver - total confusion or simply unstable?
I've been trying for the past 2 days to use ISerializationCallbackReceiver for my custom class, and I just can't seem to do it.
It seems when duplicating my object, deserialization is called with corrupted data. I'm using binary serialization, where my object serialize to 238 bytes (Printing it). On deserialization, it's trying to deserialize 127 bytes. I tried to make a breakpoint inside my serialization method, for a result of 127 bytes, but none seems to match. It seems like Unity just cut off the data. I can't find any other explanation to it..
When recompiling, which I believed was a serialization/deserialization test, the results seems consistent; serialization prints 238, deserialization prints 238. However, when restarting unity, the object is lost and no data is saved. Not even sure how to begin to debug this..
p.s. Regarding question 1: I also tried the example provided in the docs (with the dictionary), and it seems to fail on duplication as well.
Your answer
![](https://koobas.hobune.stream/wayback/20220612113941im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why is my serialized custom class/struct not properly instantiated (values return null/default) ? 0 Answers
How Can I Stop my Array Being Cleared on Runtime via Serialisation? 0 Answers
Custom classes behave like structs - Clarify 0 Answers
Understanding the need of serialization 1 Answer
Binary Serialization problem. 1 Answer