Closed Giresharu closed 7 months ago
I have the same problem, can anyone offer some help?
Same issue here: https://github.com/Cysharp/MemoryPack/issues/225
MemoryPack's binary specification does not allow retrieval of data structures without a C# type definition.
So it seems difficult to support this. ( By the way, this is a similar restriction to binary specifications such as protobuf.
If you want to dump binary data dynamically, it seems to me that MessagePack or JSON is probably the way to go .
Also, if you know the type variations in advance, please try Union.
I have a class that has a dictionary of type Dictionary<int, object>. It is used to store some data of various types. Now I want to deserialize the stored data, but I get the error message:
I have looked up similar issue and found out that object is not supported by default and I need to add a formatter for it. But I'm not quite sure how I should add a formatter for the object type. Should I add a formatter for Dictionary<int, object> or is there a more complete example to refer to?
Here is my minimal code in Unity 2021.3 Environment:
I've been researching for a few days and wrote the following code:
This code can only serialize/deserialize objects with the actual type of int. I don't know how to write the corresponding serialization for types like bool or Dictionary, etc. Also, during deserialization, I'm not sure how to determine what type the reader should currently read. I hope to receive some guidance.