#BlobAsset unique per prefab on baking.
1 messages · Page 1 of 1 (latest)
how are you creating your blob asset
it simply depends how you add it to the store
if you give it the same guid they will all share the same memory
if you give it different guids they will be unique even if the data matches
How do i give guid for it?
{
public GameObject Prefab;
private class CreatureEntityBaker : Baker<CreatureEntityAuthoring>
{
public override void Bake(CreatureEntityAuthoring authoring)
{
Debug.Log("Bake");
if (authoring.Prefab != null)
{
Debug.Log("Bake Prefab");
Client_CreatureEntityVisual visual = authoring.Prefab.GetComponent<Client_CreatureEntityVisual>();
if (visual != null)
{
Debug.Log("Bake Visual");
AssetReference assetRef = new AssetReference();
assetRef.SetEditorAsset(authoring.Prefab);
if (assetRef.RuntimeKeyIsValid())
{
Debug.Log("Bake Addressable");
var builder = new BlobBuilder(Allocator.TempJob);
ref var root = ref builder.ConstructRoot<GameplayAbilityCollection>();
var abilityBuilder = builder.Allocate(ref root.Values, visual.Abilities.Length);
for (int it = 0; it < visual.Abilities.Length; ++it)
{
Bake(visual.Abilities[it].Animation, ref abilityBuilder[0], ref builder);
}
AddComponent(new CreatureEntity()
{
Abilities = builder.CreateBlobAssetReference<GameplayAbilityCollection>(Allocator.Persistent)
});
builder.Dispose();
}
}
}
}
}
}```
there are no guids on my blob builder
How do i create with guids? i can use the asset ref guid as key maybe
so you're just creating a new blob here, none of it will be shared
if you want to share identical blob memory between entities you need to pass it to a blob asset store
in bakers this is done via
AddBlobAsset
and a few other overloads
you can either manually set a guid or just let the blob storage mem compare
basically if a blob that matches already exists, it will dispose your blob and replace the reference with the existing blob so now they both point to the same memory