mirror of
https://github.com/yasirkula/UnityAssetUsageDetector.git
synced 2026-11-19 14:32:37 +08:00
Addressable groups are checked when Addressables support is enabled (fixed #29)
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
"name": "AssetUsageDetector.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"Unity.Addressables"
|
||||
"Unity.Addressables",
|
||||
"Unity.Addressables.Editor"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
|
||||
@@ -5,6 +5,9 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
#if ASSET_USAGE_ADDRESSABLES
|
||||
using UnityEditor.AddressableAssets.Settings;
|
||||
#endif
|
||||
using UnityEditor.Animations;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -217,6 +220,9 @@ namespace AssetUsageDetectorNamespace
|
||||
{ typeof( LightmapSettings ), SearchLightmapSettings },
|
||||
{ typeof( RenderSettings ), SearchRenderSettings },
|
||||
{ typeof( SpriteAtlas ), SearchSpriteAtlas },
|
||||
#if ASSET_USAGE_ADDRESSABLES
|
||||
{ typeof(AddressableAssetSettings), SearchAddressableAssetSettings },
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1062,6 +1068,29 @@ namespace AssetUsageDetectorNamespace
|
||||
}
|
||||
}
|
||||
|
||||
#if ASSET_USAGE_ADDRESSABLES
|
||||
private ReferenceNode SearchAddressableAssetSettings(object obj)
|
||||
{
|
||||
AddressableAssetSettings addressableSettings = (AddressableAssetSettings)obj;
|
||||
ReferenceNode referenceNode = PopReferenceNode(addressableSettings);
|
||||
|
||||
// Search Addressable groups
|
||||
foreach (Object asset in assetsToSearchSet)
|
||||
{
|
||||
// Don't check redundant prefab objects
|
||||
if (asset is Component)
|
||||
continue;
|
||||
if (asset is GameObject gameObject && gameObject.transform.parent != null)
|
||||
continue;
|
||||
|
||||
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(asset, out string guid, out long _) && addressableSettings.FindAssetEntry(guid, true) is AddressableAssetEntry addressableEntry)
|
||||
referenceNode.AddLinkTo(GetReferenceNode(asset), $"Addressable: \"{addressableEntry.parentGroup.Name}\" -> \"{addressableEntry.address}\"");
|
||||
}
|
||||
|
||||
return referenceNode;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Find references from an Assembly Definition File to its Assembly Definition References
|
||||
private ReferenceNode SearchAssemblyDefinitionFile( object obj )
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= Asset Usage Detector (v2.5.7) =
|
||||
= Asset Usage Detector (v2.6.0) =
|
||||
|
||||
Documentation: https://github.com/yasirkula/UnityAssetUsageDetector
|
||||
E-mail: yasirkula@gmail.com
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.yasirkula.assetusagedetector",
|
||||
"displayName": "Asset Usage Detector",
|
||||
"version": "2.5.7",
|
||||
"version": "2.6.0",
|
||||
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
|
||||
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
|
||||
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",
|
||||
|
||||
Reference in New Issue
Block a user