diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAllAssetsProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAllAssetsProvider.cs
index bfbf3e2..d5d2ee9 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAllAssetsProvider.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAllAssetsProvider.cs
@@ -53,6 +53,12 @@ namespace YooAsset
return;
}
+ if (OwnerBundle.CacheBundle == null)
+ {
+ ProcessCacheBundleException();
+ return;
+ }
+
Status = EStatus.Loading;
}
diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs
index af83277..4d83c7b 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledAssetProvider.cs
@@ -55,12 +55,7 @@ namespace YooAsset
if (OwnerBundle.CacheBundle == null)
{
- if (OwnerBundle.IsDestroyed)
- throw new System.Exception("Should never get here !");
- Status = EStatus.Failed;
- LastError = $"The bundle {OwnerBundle.MainBundleInfo.Bundle.BundleName} has been destroyed by unity bugs !";
- YooLogger.Error(LastError);
- InvokeCompletion();
+ ProcessCacheBundleException();
return;
}
diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSubAssetsProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSubAssetsProvider.cs
index f48fb65..58dece6 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSubAssetsProvider.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSubAssetsProvider.cs
@@ -53,6 +53,12 @@ namespace YooAsset
return;
}
+ if (OwnerBundle.CacheBundle == null)
+ {
+ ProcessCacheBundleException();
+ return;
+ }
+
Status = EStatus.Loading;
}
diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs
index 445e00d..5afc00b 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs
@@ -220,6 +220,30 @@ namespace YooAsset
}
}
+ ///
+ /// 处理特殊异常
+ ///
+ protected void ProcessCacheBundleException()
+ {
+ if (OwnerBundle.IsDestroyed)
+ throw new System.Exception("Should never get here !");
+
+ if (OwnerBundle.MainBundleInfo.Bundle.IsRawFile)
+ {
+ Status = EStatus.Failed;
+ LastError = $"Cannot load asset bundle file using {nameof(ResourcePackage.LoadRawFileAsync)} method !";
+ YooLogger.Error(LastError);
+ InvokeCompletion();
+ }
+ else
+ {
+ Status = EStatus.Failed;
+ LastError = $"The bundle {OwnerBundle.MainBundleInfo.Bundle.BundleName} has been destroyed by unity bugs !";
+ YooLogger.Error(LastError);
+ InvokeCompletion();
+ }
+ }
+
///
/// 异步操作任务
///