using XGame.Framework.Asset; using XGame.Framework.Asset.Addressable.Data; using System; using UnityEditor; namespace XGame.Editor.Asset { public static class AddressableAssetInfoExt { /// /// 编辑器扩展方法 /// /// /// public static string GetAssetPath(this AssetInfo assetInfo) { return AssetDatabase.GUIDToAssetPath(assetInfo.assetGUID); } /// /// 是否内置资源 /// /// /// public static bool IsBuiltIn(this AssetInfo assetInfo) { var assetPath = assetInfo.GetAssetPath(); if (!string.IsNullOrEmpty(assetPath) && assetPath.IndexOf(PathDefine.PackageRelative, StringComparison.Ordinal) == 0) { return true; } return false; } ///// ///// 编辑器扩展方法 ///// ///// ///// //public static void SetAddressableId(this AddressableAssetInfo assetInfo, long id) //{ // var fileInfo = assetInfo.GetType().GetField("addressableId", BindingFlags.NonPublic | BindingFlags.Instance); // fileInfo?.SetValue(assetInfo, id); //} ///// ///// 编辑器扩展方法 ///// ///// ///// //public static void SetAddressableName(this AddressableAssetInfo assetInfo, string name) //{ // var fileInfo = assetInfo.GetType().GetField("addressableName", BindingFlags.NonPublic | BindingFlags.Instance); // fileInfo?.SetValue(assetInfo, name); //} ///// ///// 编辑器扩展方法 ///// ///// ///// //public static void SetGUID(this AddressableAssetInfo assetInfo, string guid) //{ // var fileInfo = assetInfo.GetType().GetField("assetGUID", BindingFlags.NonPublic | BindingFlags.Instance); // fileInfo?.SetValue(assetInfo, guid); //} } }