diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs
index 73bc410..9418057 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/SubAssetsOperationHandle.cs
@@ -1,4 +1,5 @@
-
+using System.Collections.Generic;
+
namespace YooAsset
{
public sealed class SubAssetsOperationHandle : OperationHandleBase
@@ -77,34 +78,35 @@ namespace YooAsset
if (IsValid == false)
return null;
- foreach (var asset in Provider.AllAssetObjects)
+ foreach (var assetObject in Provider.AllAssetObjects)
{
- if (asset.name == assetName)
- return asset as TObject;
+ if (assetObject.name == assetName)
+ return assetObject as TObject;
}
YooLogger.Warning($"Not found sub asset object : {assetName}");
return null;
}
-
-
- ///
- /// 获取图集下所有的精灵对象集合
- ///
- /// 子资源对象类型
- public TObject[] GetSubAssetObjects() where TObject : UnityEngine.Object
- {
- List ret = new List();
- if (IsValid == false)
- {
- return null;
- }
- foreach (var e in _provider.AllAssetObjects)
- {
- ret.Add(e as TObject);
- }
- return ret.ToArray();
- }
+ ///
+ /// 获取所有的子资源对象集合
+ ///
+ /// 子资源对象类型
+ public TObject[] GetSubAssetObjects() where TObject : UnityEngine.Object
+ {
+ if (IsValid == false)
+ return null;
+
+ List ret = new List(Provider.AllAssetObjects.Length);
+ foreach (var assetObject in Provider.AllAssetObjects)
+ {
+ var retObject = assetObject as TObject;
+ if (retObject != null)
+ ret.Add(retObject);
+ else
+ YooLogger.Warning($"The type conversion failed : {assetObject.name}");
+ }
+ return ret.ToArray();
+ }
}
}
\ No newline at end of file