Static Store

Static store for multi scene setup.
This commit is contained in:
max 2021-01-13 10:16:22 +01:00
parent cab2c4ad12
commit 6c9a52c1a6
2 changed files with 9 additions and 2 deletions

View File

@ -12,6 +12,9 @@ namespace TAO.VertexAnimation
public class VA_AnimationLibraryConversionSystem : GameObjectConversionSystem public class VA_AnimationLibraryConversionSystem : GameObjectConversionSystem
{ {
// Static because of multi scene setup.
public static BlobAssetReference<VA_AnimationLibraryData> animLibAssetRef;
protected override void OnUpdate() protected override void OnUpdate()
{ {
Entities.ForEach((VA_AnimationLibraryComponentAuthoring animationLib) => Entities.ForEach((VA_AnimationLibraryComponentAuthoring animationLib) =>
@ -34,7 +37,9 @@ namespace TAO.VertexAnimation
} }
// Construct blob asset reference. // Construct blob asset reference.
BlobAssetReference<VA_AnimationLibraryData> animLibAssetRef = blobBuilder.CreateBlobAssetReference<VA_AnimationLibraryData>(Allocator.Persistent); //BlobAssetReference<VA_AnimationLibraryData> animLibAssetRef = blobBuilder.CreateBlobAssetReference<VA_AnimationLibraryData>(Allocator.Persistent);
// Static because of multi scene setup.
animLibAssetRef = blobBuilder.CreateBlobAssetReference<VA_AnimationLibraryData>(Allocator.Persistent);
// Add it to the asset store. // Add it to the asset store.
BlobAssetStore.TryAdd(new Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), animLibAssetRef); BlobAssetStore.TryAdd(new Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), animLibAssetRef);

View File

@ -26,7 +26,9 @@ namespace TAO.VertexAnimation
{ {
protected override void OnUpdate() protected override void OnUpdate()
{ {
BlobAssetStore.TryGet(new Unity.Entities.Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), out BlobAssetReference<VA_AnimationLibraryData> animLib); //BlobAssetStore.TryGet(new Unity.Entities.Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), out BlobAssetReference<VA_AnimationLibraryData> animLib);
// Static because of multi scene setup.
BlobAssetReference<VA_AnimationLibraryData> animLib = VA_AnimationLibraryConversionSystem.animLibAssetRef;
Entities.ForEach((VA_AnimatorComponentAuthoring animator) => Entities.ForEach((VA_AnimatorComponentAuthoring animator) =>
{ {