#Is BlobAssetReference<Collider> inside of PhysicsCollider shared across multiple PhysicsColliders?

1 messages · Page 1 of 1 (latest)

little bone
#

Is the BlobAssetReference<Collider> Value inside of PhysicsCollider shared across multiple PhysicsCollider components? Or does each PhysicsCollider have a unique BlobAssetReference?

I'm running into a case where I replace a PhysicsCollider with a new BlobAssetReference and Dispose the old one, but later the Physics code begins throwing a fit of exceptions related to a BlobAssetReference is not valid. Trying to track down the reason.

little bone
#

I should note I am using Entities 0.51 currently, and the original PhysicsCollider I am replacing was created at runtime using the (now defunct in 1.0) GameObject->Entity conversion workflow.

#

So I assume the BlobAssetReferences created that way fall under "you are in charge of manually disposing them"

zealous talon
#

its unique if you enable force unique in the authoring component - if you completely dispose of one and replace it on one entity and dont update the other entities and their respective components I assume that is the cause of the blob not valid errors

little bone
#

Well when you dispose a BlobAssetReference, that is not the same as disposing the BlobAsset, is it?

#

Let's say I have spawned 100 spheres each with their own BlobAssetReference to a single BlobAsset that is the Physics Collider for them

#

I decide I want to change the size of one of those spheres. So I create a new BlobAsset and BlobAssetReference to be a large sphere.

#

Then I attach that BlobAssetReference to one of the 100 spheres.

I would then need to dispose of its old BlobAssetReference UNLESS the 99 others are still using it.

But I don't know if that is how it works.

rapid dagger
#

blob assets are usually owned by a BlobAssetStore so you should let this handle the life cycle

#

unless you have created the blob asset yourself

little bone
#

Yeah I am not touching the blob asset itself

#

But I am changing the BlobAssetReference and am asking if I need to dispose it myself

#

I am of the understanding a blob asset and a blob asset reference are two different things

brazen hull
#

If you create your own blob asset (e.g., with any of the Create() functions from colliders, such as MeshCollider.Create()), you will have to dispose it yourself.
Don't dispose the originally created blob asset since as @rapid dagger and @zealous talon are saying, these are managed internally and potentially shared.