From a422bcc8589f12dd0d31bd441714946fbf498d9b Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 12 Aug 2022 14:30:23 +0800 Subject: [PATCH] Update AssetSystem --- .../AssetSystem/Provider/BundledAssetProvider.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs index 3923ba8..66088a4 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs @@ -60,6 +60,16 @@ namespace YooAsset return; } + if (OwnerBundle.CacheBundle == null) + { + if (OwnerBundle.IsDestroyed) + throw new System.Exception("Should never get here !"); + Status = EStatus.Fail; + LastError = $"The bundle {OwnerBundle.MainBundleInfo.BundleName} has been destroyed by unity bugs !"; + InvokeCompletion(); + return; + } + Status = EStatus.Loading; } @@ -105,7 +115,7 @@ namespace YooAsset Status = AssetObject == null ? EStatus.Fail : EStatus.Success; if (Status == EStatus.Fail) { - if(MainAssetInfo.AssetType == null) + if (MainAssetInfo.AssetType == null) LastError = $"Failed to load asset : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.BundleName}"; else LastError = $"Failed to load asset : {MainAssetInfo.AssetPath} AssetType : {MainAssetInfo.AssetType} AssetBundle : {OwnerBundle.MainBundleInfo.BundleName}";