diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index a4fa8e4..8f40902 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -141,7 +141,7 @@ namespace YooAsset if (assetInfo.IsInvalid) { CompletedProvider completedProvider = new CompletedProvider(assetInfo); - completedProvider.SetCompleted(); + completedProvider.SetCompleted(assetInfo.Error); return completedProvider.CreateHandle(); } @@ -176,7 +176,7 @@ namespace YooAsset if (assetInfo.IsInvalid) { CompletedProvider completedProvider = new CompletedProvider(assetInfo); - completedProvider.SetCompleted(); + completedProvider.SetCompleted(assetInfo.Error); return completedProvider.CreateHandle(); } @@ -202,7 +202,7 @@ namespace YooAsset if (assetInfo.IsInvalid) { CompletedProvider completedProvider = new CompletedProvider(assetInfo); - completedProvider.SetCompleted(); + completedProvider.SetCompleted(assetInfo.Error); return completedProvider.CreateHandle(); } diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/CompletedProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/CompletedProvider.cs index 9ce9095..dc51312 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/CompletedProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/CompletedProvider.cs @@ -20,12 +20,12 @@ namespace YooAsset public override void Update() { } - public void SetCompleted() + public void SetCompleted(string error) { if (Status == EStatus.None) { Status = EStatus.Fail; - LastError = MainAssetInfo.Error; + LastError = error; InvokeCompletion(); } } diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index 2b464fb..25da7db 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -522,15 +522,17 @@ namespace YooAsset return operation; } +#if UNITY_EDITOR BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo); if (bundleInfo.Bundle.IsRawFile == false) { - string error = $"Cannot load asset bundle file using {nameof(GetRawFileAsync)} interfaces !"; - YooLogger.Warning(error); + string error = $"Cannot load asset bundle file using {nameof(GetRawFileAsync)} method !"; + YooLogger.Error(error); RawFileOperation operation = new CompletedRawFileOperation(error, copyPath); OperationSystem.StartOperation(operation); return operation; } +#endif if (_playMode == EPlayMode.EditorSimulateMode) { @@ -667,6 +669,18 @@ namespace YooAsset private static AssetOperationHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete) { +#if UNITY_EDITOR + BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo); + if (bundleInfo.Bundle.IsRawFile) + { + string error = $"Cannot load raw file using LoadAsset method !"; + YooLogger.Error(error); + CompletedProvider completedProvider = new CompletedProvider(assetInfo); + completedProvider.SetCompleted(error); + return completedProvider.CreateHandle(); + } +#endif + var handle = AssetSystem.LoadAssetAsync(assetInfo); if (waitForAsyncComplete) handle.WaitForAsyncComplete(); @@ -751,6 +765,18 @@ namespace YooAsset private static SubAssetsOperationHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete) { +#if UNITY_EDITOR + BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo); + if (bundleInfo.Bundle.IsRawFile) + { + string error = $"Cannot load raw file using LoadSubAssets method !"; + YooLogger.Error(error); + CompletedProvider completedProvider = new CompletedProvider(assetInfo); + completedProvider.SetCompleted(error); + return completedProvider.CreateHandle(); + } +#endif + var handle = AssetSystem.LoadSubAssetsAsync(assetInfo); if (waitForAsyncComplete) handle.WaitForAsyncComplete();