From 6c9a52c1a661570c4328a370dc00dff3418aec48 Mon Sep 17 00:00:00 2001 From: max Date: Wed, 13 Jan 2021 10:16:22 +0100 Subject: [PATCH] Static Store Static store for multi scene setup. --- Runtime/Scripts/VA_AnimationLibraryComponentAuthoring.cs | 7 ++++++- Runtime/Scripts/VA_AnimatorComponentAuthoring.cs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Runtime/Scripts/VA_AnimationLibraryComponentAuthoring.cs b/Runtime/Scripts/VA_AnimationLibraryComponentAuthoring.cs index 30245b7..ac61329 100644 --- a/Runtime/Scripts/VA_AnimationLibraryComponentAuthoring.cs +++ b/Runtime/Scripts/VA_AnimationLibraryComponentAuthoring.cs @@ -12,6 +12,9 @@ namespace TAO.VertexAnimation public class VA_AnimationLibraryConversionSystem : GameObjectConversionSystem { + // Static because of multi scene setup. + public static BlobAssetReference animLibAssetRef; + protected override void OnUpdate() { Entities.ForEach((VA_AnimationLibraryComponentAuthoring animationLib) => @@ -34,7 +37,9 @@ namespace TAO.VertexAnimation } // Construct blob asset reference. - BlobAssetReference animLibAssetRef = blobBuilder.CreateBlobAssetReference(Allocator.Persistent); + //BlobAssetReference animLibAssetRef = blobBuilder.CreateBlobAssetReference(Allocator.Persistent); + // Static because of multi scene setup. + animLibAssetRef = blobBuilder.CreateBlobAssetReference(Allocator.Persistent); // Add it to the asset store. BlobAssetStore.TryAdd(new Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), animLibAssetRef); diff --git a/Runtime/Scripts/VA_AnimatorComponentAuthoring.cs b/Runtime/Scripts/VA_AnimatorComponentAuthoring.cs index b06a596..24ce3e9 100644 --- a/Runtime/Scripts/VA_AnimatorComponentAuthoring.cs +++ b/Runtime/Scripts/VA_AnimatorComponentAuthoring.cs @@ -26,7 +26,9 @@ namespace TAO.VertexAnimation { protected override void OnUpdate() { - BlobAssetStore.TryGet(new Unity.Entities.Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), out BlobAssetReference animLib); + //BlobAssetStore.TryGet(new Unity.Entities.Hash128(VA_AnimationLibraryUtils.AnimationLibraryAssetStoreName), out BlobAssetReference animLib); + // Static because of multi scene setup. + BlobAssetReference animLib = VA_AnimationLibraryConversionSystem.animLibAssetRef; Entities.ForEach((VA_AnimatorComponentAuthoring animator) => {