update asset system

真机上使用错误方法加载原生文件的时候给予正确的错误提示。
mlyDevMerge1.5.7
hevinci 2023-07-07 12:16:16 +08:00 committed by QiJing
parent 885c35bf9d
commit bc38159bed
4 changed files with 37 additions and 6 deletions

View File

@ -53,6 +53,12 @@ namespace YooAsset
return; return;
} }
if (OwnerBundle.CacheBundle == null)
{
ProcessCacheBundleException();
return;
}
Status = EStatus.Loading; Status = EStatus.Loading;
} }

View File

@ -55,12 +55,7 @@ namespace YooAsset
if (OwnerBundle.CacheBundle == null) if (OwnerBundle.CacheBundle == null)
{ {
if (OwnerBundle.IsDestroyed) ProcessCacheBundleException();
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();
return; return;
} }

View File

@ -53,6 +53,12 @@ namespace YooAsset
return; return;
} }
if (OwnerBundle.CacheBundle == null)
{
ProcessCacheBundleException();
return;
}
Status = EStatus.Loading; Status = EStatus.Loading;
} }

View File

@ -220,6 +220,30 @@ namespace YooAsset
} }
} }
/// <summary>
/// 处理特殊异常
/// </summary>
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();
}
}
/// <summary> /// <summary>
/// 异步操作任务 /// 异步操作任务
/// </summary> /// </summary>