Merge pull request #11 from jiangguilong2000/main

feat(AssetSystem): 获取图集下所有的精灵对象集合
pull/13/head
何冠峰 2022-05-13 14:23:23 +08:00 committed by GitHub
commit 2f9d3a9f11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -86,5 +86,25 @@ namespace YooAsset
YooLogger.Warning($"Not found sub asset object : {assetName}");
return null;
}
/// <summary>
/// 获取图集下所有的精灵对象集合
/// </summary>
/// <typeparam name="TObject">子资源对象类型</typeparam>
public TObject[] GetSubAssetObjects<TObject>() where TObject : UnityEngine.Object
{
List<TObject> ret = new List<TObject>();
if (IsValid == false)
{
return null;
}
foreach (var e in _provider.AllAssetObjects)
{
ret.Add(e as TObject);
}
return ret.ToArray();
}
}
}