Files
BABA_YAGA/Assets/Third Parties/D.A. Assets/DA-Shared/Runtime/Extensions/AssetDatabaseExtensions.cs

22 lines
694 B
C#
Raw Normal View History

2026-05-13 23:02:02 +07:00
using System.Collections.Generic;
using System.Linq;
namespace DA_Assets.Extensions
{
public static class AssetDatabaseExtensions
{
public static List<string> FindAssetsPathes<T>(this string path, string customType = null)
{
List<string> assetPathes = new List<string>();
if (customType == null)
customType = $"t:{typeof(T).Name}";
#if UNITY_EDITOR
string[] guids = UnityEditor.AssetDatabase.FindAssets(customType, new string[] { path.ToRelativePath() });
assetPathes = guids.Select(x => UnityEditor.AssetDatabase.GUIDToAssetPath(x)).ToList();
#endif
return assetPathes;
}
}
}