24-05-2021, 12:58 PM
(24-05-2021, 12:26 PM)josemendez Wrote: ObiNativeList internally holds a raw pointer to unmanaged data, so BinaryFormatter won't work. Furthermore, serializing the entire list does not make much sense in this context, as you're interested in the data for each individual actor, not the entire solver. There's no guarantee data belonging to different actors will be laid out in memory in exactly the same way in different machines.
Internally we use Unity's ISerializationCallbackReceiver interface to manually serialize/deserialize this data using unsafe operations (Unity.Collections.LowLevel.Unsafe), however this is *unsafe* as the name implies and can easily crash if you're not 100% sure of what you're doing.
Easiest way is probably to just iterate trough the list manually and serialize each entry to a format of your choice.
Thanks!