Skip to content

Commit 8f83162

Browse files
committed
Addressable groups are checked when Addressables support is enabled (fixed #29)
1 parent 6edf344 commit 8f83162

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

Plugins/AssetUsageDetector/Editor/AssetUsageDetector.Editor.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "AssetUsageDetector.Editor",
33
"rootNamespace": "",
44
"references": [
5-
"Unity.Addressables"
5+
"Unity.Addressables",
6+
"Unity.Addressables.Editor"
67
],
78
"includePlatforms": [
89
"Editor"

Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
using System.Reflection;
66
using System.Text;
77
using UnityEditor;
8+
#if ASSET_USAGE_ADDRESSABLES
9+
using UnityEditor.AddressableAssets.Settings;
10+
#endif
811
using UnityEditor.Animations;
912
using UnityEngine;
1013
using UnityEngine.UI;
@@ -217,6 +220,9 @@ private void InitializeSearchFunctionsData( Parameters searchParameters )
217220
{ typeof( LightmapSettings ), SearchLightmapSettings },
218221
{ typeof( RenderSettings ), SearchRenderSettings },
219222
{ typeof( SpriteAtlas ), SearchSpriteAtlas },
223+
#if ASSET_USAGE_ADDRESSABLES
224+
{ typeof(AddressableAssetSettings), SearchAddressableAssetSettings },
225+
#endif
220226
};
221227
}
222228

@@ -1062,6 +1068,29 @@ private void SearchSpriteAtlas( ReferenceNode referenceNode, Object packedAsset
10621068
}
10631069
}
10641070

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+
10651094
// Find references from an Assembly Definition File to its Assembly Definition References
10661095
private ReferenceNode SearchAssemblyDefinitionFile( object obj )
10671096
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Asset Usage Detector (v2.5.7) =
1+
= Asset Usage Detector (v2.6.0) =
22

33
Documentation: https://github.com/yasirkula/UnityAssetUsageDetector
44
E-mail: yasirkula@gmail.com

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.assetusagedetector",
33
"displayName": "Asset Usage Detector",
4-
"version": "2.5.7",
4+
"version": "2.6.0",
55
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
66
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)