Search Unity

Question How to Serialize Blob Asset References

Discussion in 'Entity Component System' started by merobbins5, Jun 28, 2020.

  1. merobbins5

    merobbins5

    Joined:
    Jun 16, 2020
    Posts:
    7
    After successfully serializing and deserializing the world one time, I fail on the second try. I think this is because deserializing the world gives each of my entities a BlobAssetOwner shared component automatically.

    Code (CSharp):
    1. entityManager.GetSharedComponentData<BlobAssetOwner>(e);
    BlobAssetOwner is inaccessible due to it's protection level. How can I save the pointer to its data to prevent the BlobAssetReference from becoming invalid/released the next time I save and load the world?

    Code (CSharp):
    1. BlobAssetSerializeExtensions.Write<T>(this BinaryWriter binaryWriter, BlobAssetReference<T> blob)
    Looks promising, but I don't know how to access and pass in the BlobAssetReferences that are being used by my entities.

    All I'm running is a simple physics simulation with 2 objects. What data was stored in these blobassets? I haven't made any myself, so I'm assuming it's physics data or material data?