|
5 | 5 | using System.Reflection; |
6 | 6 | using System.Text; |
7 | 7 | using UnityEditor; |
| 8 | +#if ASSET_USAGE_ADDRESSABLES |
| 9 | +using UnityEditor.AddressableAssets.Settings; |
| 10 | +#endif |
8 | 11 | using UnityEditor.Animations; |
9 | 12 | using UnityEngine; |
10 | 13 | using UnityEngine.UI; |
@@ -217,6 +220,9 @@ private void InitializeSearchFunctionsData( Parameters searchParameters ) |
217 | 220 | { typeof( LightmapSettings ), SearchLightmapSettings }, |
218 | 221 | { typeof( RenderSettings ), SearchRenderSettings }, |
219 | 222 | { typeof( SpriteAtlas ), SearchSpriteAtlas }, |
| 223 | +#if ASSET_USAGE_ADDRESSABLES |
| 224 | + { typeof(AddressableAssetSettings), SearchAddressableAssetSettings }, |
| 225 | +#endif |
220 | 226 | }; |
221 | 227 | } |
222 | 228 |
|
@@ -1062,6 +1068,29 @@ private void SearchSpriteAtlas( ReferenceNode referenceNode, Object packedAsset |
1062 | 1068 | } |
1063 | 1069 | } |
1064 | 1070 |
|
| 1071 | +#if ASSET_USAGE_ADDRESSABLES |
| 1072 | + private ReferenceNode SearchAddressableAssetSettings(object obj) |
| 1073 | + { |
| 1074 | + AddressableAssetSettings addressableSettings = (AddressableAssetSettings)obj; |
| 1075 | + ReferenceNode referenceNode = PopReferenceNode(addressableSettings); |
| 1076 | + |
| 1077 | + // Search Addressable groups |
| 1078 | + foreach (Object asset in assetsToSearchSet) |
| 1079 | + { |
| 1080 | + // Don't check redundant prefab objects |
| 1081 | + if (asset is Component) |
| 1082 | + continue; |
| 1083 | + if (asset is GameObject gameObject && gameObject.transform.parent != null) |
| 1084 | + continue; |
| 1085 | + |
| 1086 | + if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(asset, out string guid, out long _) && addressableSettings.FindAssetEntry(guid, true) is AddressableAssetEntry addressableEntry) |
| 1087 | + referenceNode.AddLinkTo(GetReferenceNode(asset), $"Addressable: \"{addressableEntry.parentGroup.Name}\" -> \"{addressableEntry.address}\""); |
| 1088 | + } |
| 1089 | + |
| 1090 | + return referenceNode; |
| 1091 | + } |
| 1092 | +#endif |
| 1093 | + |
1065 | 1094 | // Find references from an Assembly Definition File to its Assembly Definition References |
1066 | 1095 | private ReferenceNode SearchAssemblyDefinitionFile( object obj ) |
1067 | 1096 | { |
|
0 commit comments