mirror of
https://github.com/yasirkula/UnityAssetUsageDetector.git
synced 2026-11-20 23:12:38 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5b082c093 | |||
| 1faa789f48 | |||
| 610fffc763 | |||
| 9fddcab6fa | |||
| 66dd66787c |
@@ -53,7 +53,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
#endif
|
#endif
|
||||||
public bool calculateUnusedObjects = false;
|
public bool calculateUnusedObjects = false;
|
||||||
public bool hideDuplicateRows = true;
|
public bool hideDuplicateRows = true;
|
||||||
public bool hideReduntantPrefabVariantLinks = true;
|
public bool hideNonOverriddenPrefabVariablesInAssets = true;
|
||||||
|
public bool hideNonOverriddenPrefabVariablesInScenes = false;
|
||||||
public bool noAssetDatabaseChanges = false;
|
public bool noAssetDatabaseChanges = false;
|
||||||
public bool showDetailedProgressBar = true;
|
public bool showDetailedProgressBar = true;
|
||||||
}
|
}
|
||||||
@@ -711,6 +712,19 @@ namespace AssetUsageDetectorNamespace
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
string assetPath = AssetDatabase.GetAssetPath( obj );
|
string assetPath = AssetDatabase.GetAssetPath( obj );
|
||||||
|
|
||||||
|
// Omit unused sub-assets whose parent assets are used (configurable via Settings)
|
||||||
|
if( AssetUsageDetectorSettings.MarkUsedAssetsSubAssetsAsUsed && AssetDatabase.IsSubAsset( obj ) && usedObjectsSet.Contains( AssetDatabase.LoadMainAssetAtPath( assetPath ) ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Omit meshes of an imported model asset
|
||||||
|
if( obj is Mesh && !string.IsNullOrEmpty( assetPath ) && AssetDatabase.GetMainAssetTypeAtPath( assetPath ) == typeof( GameObject ) && objectsToSearchSet.Contains( AssetDatabase.LoadMainAssetAtPath( assetPath ) ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Omit MonoScripts whose types can't be determined
|
||||||
|
if( obj is MonoScript && ( (MonoScript) obj ).GetClass() == null )
|
||||||
|
continue;
|
||||||
|
|
||||||
GameObject searchedTopmostGameObject = null;
|
GameObject searchedTopmostGameObject = null;
|
||||||
if( obj is GameObject )
|
if( obj is GameObject )
|
||||||
{
|
{
|
||||||
@@ -738,14 +752,6 @@ namespace AssetUsageDetectorNamespace
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Omit meshes of an imported model asset
|
|
||||||
if( obj is Mesh && !string.IsNullOrEmpty( assetPath ) && AssetDatabase.GetMainAssetTypeAtPath( assetPath ) == typeof( GameObject ) && objectsToSearchSet.Contains( AssetDatabase.LoadMainAssetAtPath( assetPath ) ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Omit MonoScripts whose types can't be determined
|
|
||||||
if( obj is MonoScript && ( (MonoScript) obj ).GetClass() == null )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Use new ReferenceNodes in UnusedObjects search result group because we don't want these nodes to be linked to the actual ReferenceNodes in any way
|
// Use new ReferenceNodes in UnusedObjects search result group because we don't want these nodes to be linked to the actual ReferenceNodes in any way
|
||||||
// (i.e. we don't use actual ReferenceNodes of these objects (GetReferenceNode) because these may have links to other nodes in unknown circumstances)
|
// (i.e. we don't use actual ReferenceNodes of these objects (GetReferenceNode) because these may have links to other nodes in unknown circumstances)
|
||||||
ReferenceNode node = PopReferenceNode( obj );
|
ReferenceNode node = PopReferenceNode( obj );
|
||||||
|
|||||||
@@ -217,8 +217,9 @@ namespace AssetUsageDetectorNamespace
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ASSET_USAGE_VFX_GRAPH
|
#if ASSET_USAGE_VFX_GRAPH
|
||||||
private readonly Func<string, object> vfxResourceGetter = (Func<string, object>) Delegate.CreateDelegate( typeof( Func<string, object> ), typeof( Editor ).Assembly.GetType( "UnityEditor.VFX.VisualEffectResource" ).GetMethod( "GetResourceAtPath", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
|
private static Type vfxResourceType => typeof( Editor ).Assembly.GetType( "UnityEditor.VFX.VisualEffectResource" ) ?? Array.Find( AppDomain.CurrentDomain.GetAssemblies(), ( assembly ) => assembly.GetName().Name == "UnityEditor.VFXModule" ).GetType( "UnityEditor.VFX.VisualEffectResource" );
|
||||||
private readonly MethodInfo vfxResourceContentsGetter = typeof( Editor ).Assembly.GetType( "UnityEditor.VFX.VisualEffectResource" ).GetMethod( "GetContents", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
|
private readonly Func<string, object> vfxResourceGetter = (Func<string, object>) Delegate.CreateDelegate( typeof( Func<string, object> ), vfxResourceType.GetMethod( "GetResourceAtPath", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
|
||||||
|
private readonly MethodInfo vfxResourceContentsGetter = vfxResourceType.GetMethod( "GetContents", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
|
||||||
private readonly MethodInfo vfxSerializableObjectValueGetter = Array.Find( Array.Find( AppDomain.CurrentDomain.GetAssemblies(), ( assembly ) => assembly.GetName().Name == "Unity.VisualEffectGraph.Editor" ).GetType( "UnityEditor.VFX.VFXSerializableObject" ).GetMethods( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance ), ( methodInfo ) => methodInfo.Name == "Get" && !methodInfo.IsGenericMethod );
|
private readonly MethodInfo vfxSerializableObjectValueGetter = Array.Find( Array.Find( AppDomain.CurrentDomain.GetAssemblies(), ( assembly ) => assembly.GetName().Name == "Unity.VisualEffectGraph.Editor" ).GetType( "UnityEditor.VFX.VFXSerializableObject" ).GetMethods( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance ), ( methodInfo ) => methodInfo.Name == "Get" && !methodInfo.IsGenericMethod );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1452,7 +1453,7 @@ namespace AssetUsageDetectorNamespace
|
|||||||
{
|
{
|
||||||
bool iteratingVisible = iteratorVisible.NextVisible( true );
|
bool iteratingVisible = iteratorVisible.NextVisible( true );
|
||||||
#if UNITY_2018_3_OR_NEWER
|
#if UNITY_2018_3_OR_NEWER
|
||||||
bool searchPrefabOverridesOnly = searchParameters.hideReduntantPrefabVariantLinks && unityObject.IsAsset() && PrefabUtility.GetCorrespondingObjectFromSource( unityObject ) != null;
|
bool searchPrefabOverridesOnly = ( ( searchParameters.hideNonOverriddenPrefabVariablesInAssets && unityObject.IsAsset() ) || ( searchParameters.hideNonOverriddenPrefabVariablesInScenes && !unityObject.IsAsset() ) ) && PrefabUtility.GetCorrespondingObjectFromSource( unityObject ) != null;
|
||||||
#endif
|
#endif
|
||||||
bool enterChildren;
|
bool enterChildren;
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -124,6 +124,13 @@ namespace AssetUsageDetectorNamespace
|
|||||||
set { if( m_selectDoubleClickedObjects == value ) return; m_selectDoubleClickedObjects = value; EditorPrefs.SetBool( "AUD_SelectDoubleClickedObj", value ); }
|
set { if( m_selectDoubleClickedObjects == value ) return; m_selectDoubleClickedObjects = value; EditorPrefs.SetBool( "AUD_SelectDoubleClickedObj", value ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool? m_markUsedAssetsSubAssetsAsUsed = null;
|
||||||
|
public static bool MarkUsedAssetsSubAssetsAsUsed
|
||||||
|
{
|
||||||
|
get { if( m_markUsedAssetsSubAssetsAsUsed == null ) m_markUsedAssetsSubAssetsAsUsed = EditorPrefs.GetBool( "AUD_MarkUsedAssetsSubAssetsAsUsed", true ); return m_markUsedAssetsSubAssetsAsUsed.Value; }
|
||||||
|
set { if( m_markUsedAssetsSubAssetsAsUsed == value ) return; m_markUsedAssetsSubAssetsAsUsed = value; EditorPrefs.SetBool( "AUD_MarkUsedAssetsSubAssetsAsUsed", value ); }
|
||||||
|
}
|
||||||
|
|
||||||
private static bool? m_showUnityTooltip = null;
|
private static bool? m_showUnityTooltip = null;
|
||||||
public static bool ShowUnityTooltip
|
public static bool ShowUnityTooltip
|
||||||
{
|
{
|
||||||
@@ -186,20 +193,22 @@ namespace AssetUsageDetectorNamespace
|
|||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
EditorGUIUtility.labelWidth += 140f;
|
ShowRootAssetName = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Show Root Asset's Name For Sub-Assets (Requires Refresh)", ShowRootAssetName );
|
||||||
ShowRootAssetName = EditorGUILayout.Toggle( "Show Root Asset's Name For Sub-Assets (Requires Refresh)", ShowRootAssetName );
|
|
||||||
EditorGUIUtility.labelWidth -= 140f;
|
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
PingClickedObjects = EditorGUILayout.Toggle( "Ping Clicked Objects", PingClickedObjects );
|
PingClickedObjects = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Ping Clicked Objects", PingClickedObjects );
|
||||||
SelectClickedObjects = EditorGUILayout.Toggle( "Select Clicked Objects", SelectClickedObjects );
|
SelectClickedObjects = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Select Clicked Objects", SelectClickedObjects );
|
||||||
SelectDoubleClickedObjects = EditorGUILayout.Toggle( "Select Double Clicked Objects", SelectDoubleClickedObjects );
|
SelectDoubleClickedObjects = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Select Double Clicked Objects", SelectDoubleClickedObjects );
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
ShowUnityTooltip = EditorGUILayout.Toggle( "Show Unity Tooltip", ShowUnityTooltip );
|
MarkUsedAssetsSubAssetsAsUsed = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Hide unused sub-assets in \"Unused Objects\" list if their parent assets are used (Requires Refresh)", MarkUsedAssetsSubAssetsAsUsed );
|
||||||
ShowCustomTooltip = EditorGUILayout.Toggle( "Show Custom Tooltip", ShowCustomTooltip );
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
ShowUnityTooltip = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Show Unity Tooltip", ShowUnityTooltip );
|
||||||
|
ShowCustomTooltip = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Show Custom Tooltip", ShowCustomTooltip );
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
CustomTooltipDelay = FloatField( "Delay", CustomTooltipDelay, 0.7f );
|
CustomTooltipDelay = FloatField( "Delay", CustomTooltipDelay, 0.7f );
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
@@ -223,7 +232,7 @@ namespace AssetUsageDetectorNamespace
|
|||||||
SelectedRowOccurrencesColor = ColorField( "Selected Row All Occurrences Tint", SelectedRowOccurrencesColor, EditorGUIUtility.isProSkin ? new Color( 0f, 0.3f, 0.75f, 1f ) : new Color( 0.25f, 0.75f, 1f, 1f ) );
|
SelectedRowOccurrencesColor = ColorField( "Selected Row All Occurrences Tint", SelectedRowOccurrencesColor, EditorGUIUtility.isProSkin ? new Color( 0f, 0.3f, 0.75f, 1f ) : new Color( 0.25f, 0.75f, 1f, 1f ) );
|
||||||
SearchMatchingTextColor = ColorField( "Matching Search Text Color", SearchMatchingTextColor, Color.red );
|
SearchMatchingTextColor = ColorField( "Matching Search Text Color", SearchMatchingTextColor, Color.red );
|
||||||
|
|
||||||
ShowTreeLines = EditorGUILayout.Toggle( "Show Tree Lines", ShowTreeLines );
|
ShowTreeLines = AssetUsageDetectorWindow.WordWrappingToggleLeft( "Show Tree Lines", ShowTreeLines );
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
TreeLinesColor = ColorField( "Normal Color", TreeLinesColor, EditorGUIUtility.isProSkin ? new Color( 0.65f, 0.65f, 0.65f, 1f ) : new Color( 0.375f, 0.375f, 0.375f, 1f ) );
|
TreeLinesColor = ColorField( "Normal Color", TreeLinesColor, EditorGUIUtility.isProSkin ? new Color( 0.65f, 0.65f, 0.65f, 1f ) : new Color( 0.375f, 0.375f, 0.375f, 1f ) );
|
||||||
HighlightedTreeLinesColor = ColorField( "Highlighted Color", HighlightedTreeLinesColor, Color.cyan );
|
HighlightedTreeLinesColor = ColorField( "Highlighted Color", HighlightedTreeLinesColor, Color.cyan );
|
||||||
|
|||||||
@@ -35,13 +35,14 @@ namespace AssetUsageDetectorNamespace
|
|||||||
private const string PREFS_ADDRESSABLES_SUPPORT = "AUD_AddressablesSupport";
|
private const string PREFS_ADDRESSABLES_SUPPORT = "AUD_AddressablesSupport";
|
||||||
private const string PREFS_CALCULATE_UNUSED_OBJECTS = "AUD_FindUnusedObjs";
|
private const string PREFS_CALCULATE_UNUSED_OBJECTS = "AUD_FindUnusedObjs";
|
||||||
private const string PREFS_HIDE_DUPLICATE_ROWS = "AUD_HideDuplicates";
|
private const string PREFS_HIDE_DUPLICATE_ROWS = "AUD_HideDuplicates";
|
||||||
private const string PREFS_HIDE_REDUNDANT_PREFAB_VARIANT_LINKS = "AUD_HideRedundantPVariantLinks";
|
private const string PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_ASSETS = "AUD_HideRedundantPVariantLinks";
|
||||||
|
private const string PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_SCENES = "AUD_HideRedundantPVarsInScenes";
|
||||||
private const string PREFS_SHOW_PROGRESS = "AUD_Progress";
|
private const string PREFS_SHOW_PROGRESS = "AUD_Progress";
|
||||||
|
|
||||||
private static readonly GUIContent windowTitle = new GUIContent( "Asset Usage Detector" );
|
private static readonly GUIContent windowTitle = new GUIContent( "Asset Usage Detector" );
|
||||||
private static readonly Vector2 windowMinSize = new Vector2( 325f, 220f );
|
private static readonly Vector2 windowMinSize = new Vector2( 325f, 220f );
|
||||||
|
|
||||||
private readonly GUILayoutOption GL_WIDTH_12 = GUILayout.Width( 12f );
|
private static readonly GUILayoutOption GL_WIDTH_12 = GUILayout.Width( 12f );
|
||||||
|
|
||||||
private GUIStyle lockButtonStyle;
|
private GUIStyle lockButtonStyle;
|
||||||
|
|
||||||
@@ -93,7 +94,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
private bool searchUnusedMaterialProperties = true;
|
private bool searchUnusedMaterialProperties = true;
|
||||||
private bool calculateUnusedObjects = false;
|
private bool calculateUnusedObjects = false;
|
||||||
private bool hideDuplicateRows = true;
|
private bool hideDuplicateRows = true;
|
||||||
private bool hideReduntantPrefabVariantLinks = true;
|
private bool hideNonOverriddenPrefabVariablesInAssets = true;
|
||||||
|
private bool hideNonOverriddenPrefabVariablesInScenes = false;
|
||||||
private bool noAssetDatabaseChanges = false;
|
private bool noAssetDatabaseChanges = false;
|
||||||
private bool showDetailedProgressBar = true;
|
private bool showDetailedProgressBar = true;
|
||||||
|
|
||||||
@@ -331,7 +333,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
#endif
|
#endif
|
||||||
calculateUnusedObjects = searchParameters.calculateUnusedObjects;
|
calculateUnusedObjects = searchParameters.calculateUnusedObjects;
|
||||||
hideDuplicateRows = searchParameters.hideDuplicateRows;
|
hideDuplicateRows = searchParameters.hideDuplicateRows;
|
||||||
hideReduntantPrefabVariantLinks = searchParameters.hideReduntantPrefabVariantLinks;
|
hideNonOverriddenPrefabVariablesInAssets = searchParameters.hideNonOverriddenPrefabVariablesInAssets;
|
||||||
|
hideNonOverriddenPrefabVariablesInScenes = searchParameters.hideNonOverriddenPrefabVariablesInScenes;
|
||||||
noAssetDatabaseChanges = searchParameters.noAssetDatabaseChanges;
|
noAssetDatabaseChanges = searchParameters.noAssetDatabaseChanges;
|
||||||
showDetailedProgressBar = searchParameters.showDetailedProgressBar;
|
showDetailedProgressBar = searchParameters.showDetailedProgressBar;
|
||||||
|
|
||||||
@@ -414,7 +417,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
#endif
|
#endif
|
||||||
EditorPrefs.SetBool( PREFS_CALCULATE_UNUSED_OBJECTS, calculateUnusedObjects );
|
EditorPrefs.SetBool( PREFS_CALCULATE_UNUSED_OBJECTS, calculateUnusedObjects );
|
||||||
EditorPrefs.SetBool( PREFS_HIDE_DUPLICATE_ROWS, hideDuplicateRows );
|
EditorPrefs.SetBool( PREFS_HIDE_DUPLICATE_ROWS, hideDuplicateRows );
|
||||||
EditorPrefs.SetBool( PREFS_HIDE_REDUNDANT_PREFAB_VARIANT_LINKS, hideReduntantPrefabVariantLinks );
|
EditorPrefs.SetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_ASSETS, hideNonOverriddenPrefabVariablesInAssets );
|
||||||
|
EditorPrefs.SetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_SCENES, hideNonOverriddenPrefabVariablesInScenes );
|
||||||
EditorPrefs.SetBool( PREFS_SHOW_PROGRESS, showDetailedProgressBar );
|
EditorPrefs.SetBool( PREFS_SHOW_PROGRESS, showDetailedProgressBar );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +440,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
#endif
|
#endif
|
||||||
calculateUnusedObjects = EditorPrefs.GetBool( PREFS_CALCULATE_UNUSED_OBJECTS, false );
|
calculateUnusedObjects = EditorPrefs.GetBool( PREFS_CALCULATE_UNUSED_OBJECTS, false );
|
||||||
hideDuplicateRows = EditorPrefs.GetBool( PREFS_HIDE_DUPLICATE_ROWS, true );
|
hideDuplicateRows = EditorPrefs.GetBool( PREFS_HIDE_DUPLICATE_ROWS, true );
|
||||||
hideReduntantPrefabVariantLinks = EditorPrefs.GetBool( PREFS_HIDE_REDUNDANT_PREFAB_VARIANT_LINKS, true );
|
hideNonOverriddenPrefabVariablesInAssets = EditorPrefs.GetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_ASSETS, true );
|
||||||
|
hideNonOverriddenPrefabVariablesInScenes = EditorPrefs.GetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_SCENES, false );
|
||||||
showDetailedProgressBar = EditorPrefs.GetBool( PREFS_SHOW_PROGRESS, true );
|
showDetailedProgressBar = EditorPrefs.GetBool( PREFS_SHOW_PROGRESS, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +588,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
calculateUnusedObjects = WordWrappingToggleLeft( "Calculate unused objects", calculateUnusedObjects );
|
calculateUnusedObjects = WordWrappingToggleLeft( "Calculate unused objects", calculateUnusedObjects );
|
||||||
hideDuplicateRows = WordWrappingToggleLeft( "Hide duplicate rows in search results", hideDuplicateRows );
|
hideDuplicateRows = WordWrappingToggleLeft( "Hide duplicate rows in search results", hideDuplicateRows );
|
||||||
#if UNITY_2018_3_OR_NEWER
|
#if UNITY_2018_3_OR_NEWER
|
||||||
hideReduntantPrefabVariantLinks = WordWrappingToggleLeft( "Hide redundant prefab variant links (when the same value is assigned to the same Component of a prefab and its variant(s))", hideReduntantPrefabVariantLinks );
|
hideNonOverriddenPrefabVariablesInAssets = WordWrappingToggleLeft( "Hide non-overridden prefab variables in assets (references found in non-overridden variables of prefab variants/nested prefabs will be hidden)", hideNonOverriddenPrefabVariablesInAssets );
|
||||||
|
hideNonOverriddenPrefabVariablesInScenes = WordWrappingToggleLeft( "Hide non-overridden prefab variables in scenes (references found in non-overridden variables of prefab instances will be hidden)", hideNonOverriddenPrefabVariablesInScenes );
|
||||||
#endif
|
#endif
|
||||||
noAssetDatabaseChanges = WordWrappingToggleLeft( "I haven't modified any assets/scenes since the last search (faster search)", noAssetDatabaseChanges );
|
noAssetDatabaseChanges = WordWrappingToggleLeft( "I haven't modified any assets/scenes since the last search (faster search)", noAssetDatabaseChanges );
|
||||||
showDetailedProgressBar = WordWrappingToggleLeft( "Update search progress bar more often (cancelable search) (slower search)", showDetailedProgressBar );
|
showDetailedProgressBar = WordWrappingToggleLeft( "Update search progress bar more often (cancelable search) (slower search)", showDetailedProgressBar );
|
||||||
@@ -674,7 +680,7 @@ namespace AssetUsageDetectorNamespace
|
|||||||
objectsToSearchDrawer.Draw( objectsToSearch );
|
objectsToSearchDrawer.Draw( objectsToSearch );
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool WordWrappingToggleLeft( string label, bool value )
|
public static bool WordWrappingToggleLeft( string label, bool value )
|
||||||
{
|
{
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
bool result = EditorGUILayout.ToggleLeft( GUIContent.none, value, GL_WIDTH_12 );
|
bool result = EditorGUILayout.ToggleLeft( GUIContent.none, value, GL_WIDTH_12 );
|
||||||
@@ -724,7 +730,8 @@ namespace AssetUsageDetectorNamespace
|
|||||||
#endif
|
#endif
|
||||||
calculateUnusedObjects = calculateUnusedObjects,
|
calculateUnusedObjects = calculateUnusedObjects,
|
||||||
hideDuplicateRows = hideDuplicateRows,
|
hideDuplicateRows = hideDuplicateRows,
|
||||||
hideReduntantPrefabVariantLinks = hideReduntantPrefabVariantLinks,
|
hideNonOverriddenPrefabVariablesInAssets = hideNonOverriddenPrefabVariablesInAssets,
|
||||||
|
hideNonOverriddenPrefabVariablesInScenes = hideNonOverriddenPrefabVariablesInScenes,
|
||||||
noAssetDatabaseChanges = noAssetDatabaseChanges,
|
noAssetDatabaseChanges = noAssetDatabaseChanges,
|
||||||
showDetailedProgressBar = showDetailedProgressBar
|
showDetailedProgressBar = showDetailedProgressBar
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -778,28 +778,47 @@ namespace AssetUsageDetectorNamespace
|
|||||||
IsExpanded = true;
|
IsExpanded = true;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if( searchResult != null && searchResult.NumberOfGroups > 1 && !string.IsNullOrEmpty( treeViewState.searchTerm ) )
|
if( !string.IsNullOrEmpty( treeViewState.searchTerm ) )
|
||||||
{
|
{
|
||||||
if( contextMenu.GetItemCount() > 0 )
|
if( contextMenu.GetItemCount() > 0 )
|
||||||
contextMenu.AddSeparator( "" );
|
contextMenu.AddSeparator( "" );
|
||||||
|
|
||||||
contextMenu.AddItem( new GUIContent( "Apply Search to All Results" ), false, () =>
|
if( searchResult != null && searchResult.NumberOfGroups > 1 )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < searchResult.NumberOfGroups; i++ )
|
contextMenu.AddItem( new GUIContent( "Apply Search to All Results" ), false, () =>
|
||||||
{
|
{
|
||||||
if( searchResult[i].treeView == null )
|
for( int i = 0; i < searchResult.NumberOfGroups; i++ )
|
||||||
continue;
|
{
|
||||||
|
if( searchResult[i].treeView == null )
|
||||||
|
continue;
|
||||||
|
|
||||||
string previousSearchTerm = searchResult[i].treeViewState.searchTerm ?? "";
|
string previousSearchTerm = searchResult[i].treeViewState.searchTerm ?? "";
|
||||||
SearchResultTreeView.SearchMode previousSearchMode = searchResult[i].treeViewState.searchMode;
|
SearchResultTreeView.SearchMode previousSearchMode = searchResult[i].treeViewState.searchMode;
|
||||||
|
|
||||||
searchResult[i].treeViewState.searchTerm = treeViewState.searchTerm ?? "";
|
searchResult[i].treeViewState.searchTerm = treeViewState.searchTerm ?? "";
|
||||||
searchResult[i].treeViewState.searchMode = treeViewState.searchMode;
|
searchResult[i].treeViewState.searchMode = treeViewState.searchMode;
|
||||||
|
|
||||||
if( treeViewState.searchTerm != previousSearchTerm || treeViewState.searchMode != previousSearchMode )
|
if( treeViewState.searchTerm != previousSearchTerm || treeViewState.searchMode != previousSearchMode )
|
||||||
searchResult[i].treeView.RefreshSearch( previousSearchTerm );
|
searchResult[i].treeView.RefreshSearch( previousSearchTerm );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
IList<TreeViewItem> treeViewRows = treeView.GetRows();
|
||||||
|
if( treeViewRows.Count > 1 ) // References are at depth 1 so if there are any references, at least 2 rows must exist
|
||||||
|
{
|
||||||
|
contextMenu.AddItem( new GUIContent( "Hide Search Results" ), false, () =>
|
||||||
|
{
|
||||||
|
List<int> removedRows = new List<int>( treeViewRows.Count );
|
||||||
|
for( int i = treeViewRows.Count - 1; i >= 0; i-- )
|
||||||
|
{
|
||||||
|
if( treeViewRows[i].depth > 0 )
|
||||||
|
removedRows.Add( treeViewRows[i].id );
|
||||||
|
}
|
||||||
|
|
||||||
|
treeView.HideItems( removedRows );
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,6 +882,9 @@ namespace AssetUsageDetectorNamespace
|
|||||||
if( searchResult != null && searchResult.SearchParameters.dontSearchInSourceAssets && searchResult.SearchParameters.objectsToSearch.Length > 1 )
|
if( searchResult != null && searchResult.SearchParameters.dontSearchInSourceAssets && searchResult.SearchParameters.objectsToSearch.Length > 1 )
|
||||||
EditorGUILayout.HelpBox( "'Don't search \"SEARCHED OBJECTS\" themselves for references' is enabled, some of these objects might be used by \"SEARCHED OBJECTS\".", MessageType.Warning );
|
EditorGUILayout.HelpBox( "'Don't search \"SEARCHED OBJECTS\" themselves for references' is enabled, some of these objects might be used by \"SEARCHED OBJECTS\".", MessageType.Warning );
|
||||||
|
|
||||||
|
if( !AssetUsageDetectorSettings.MarkUsedAssetsSubAssetsAsUsed )
|
||||||
|
EditorGUILayout.HelpBox( "'Hide unused sub-assets in \"Unused Objects\" list if their parent assets are used' is disabled, unused sub-assets' parent assets might be used.", MessageType.Warning );
|
||||||
|
|
||||||
EditorGUILayout.HelpBox( "Although no references to these objects are found, they might still be used somewhere (e.g. via Resources.Load). If you intend to delete these objects, consider creating a backup of your project first.", MessageType.Info );
|
EditorGUILayout.HelpBox( "Although no references to these objects are found, they might still be used somewhere (e.g. via Resources.Load). If you intend to delete these objects, consider creating a backup of your project first.", MessageType.Info );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,7 +900,7 @@ namespace AssetUsageDetectorNamespace
|
|||||||
if( shouldUpdateInitialTreeViewNodeId )
|
if( shouldUpdateInitialTreeViewNodeId )
|
||||||
treeViewState.initialNodeId = searchResult.nextTreeViewId;
|
treeViewState.initialNodeId = searchResult.nextTreeViewId;
|
||||||
|
|
||||||
treeView = new SearchResultTreeView( treeViewState, references, ( Type == GroupType.UnusedObjects ) ? SearchResultTreeView.TreeType.UnusedObjects : SearchResultTreeView.TreeType.Normal, searchResult != null ? searchResult.UsedObjects : null, searchResult != null && searchResult.SearchParameters.hideDuplicateRows, searchResult != null && searchResult.SearchParameters.hideReduntantPrefabVariantLinks, true );
|
treeView = new SearchResultTreeView( treeViewState, references, ( Type == GroupType.UnusedObjects ) ? SearchResultTreeView.TreeType.UnusedObjects : SearchResultTreeView.TreeType.Normal, searchResult != null ? searchResult.UsedObjects : null, searchResult != null && searchResult.SearchParameters.hideDuplicateRows, true );
|
||||||
|
|
||||||
if( isFirstInitialization )
|
if( isFirstInitialization )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ namespace AssetUsageDetectorNamespace
|
|||||||
|
|
||||||
private readonly TreeType treeType;
|
private readonly TreeType treeType;
|
||||||
private readonly bool hideDuplicateRows;
|
private readonly bool hideDuplicateRows;
|
||||||
private readonly bool hideReduntantPrefabVariantLinks;
|
|
||||||
|
|
||||||
private bool isSearching;
|
private bool isSearching;
|
||||||
|
|
||||||
@@ -164,13 +163,12 @@ namespace AssetUsageDetectorNamespace
|
|||||||
[System.Obsolete] private new string searchString { get; }
|
[System.Obsolete] private new string searchString { get; }
|
||||||
[System.Obsolete] private new bool hasSearch { get; }
|
[System.Obsolete] private new bool hasSearch { get; }
|
||||||
|
|
||||||
public SearchResultTreeView( SearchResultTreeViewState state, List<ReferenceNode> references, TreeType treeType, HashSet<Object> usedObjectsSet, bool hideDuplicateRows, bool hideReduntantPrefabVariantLinks, bool usesExternalScrollView ) : base( state )
|
public SearchResultTreeView( SearchResultTreeViewState state, List<ReferenceNode> references, TreeType treeType, HashSet<Object> usedObjectsSet, bool hideDuplicateRows, bool usesExternalScrollView ) : base( state )
|
||||||
{
|
{
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.references = references;
|
this.references = references;
|
||||||
this.treeType = treeType;
|
this.treeType = treeType;
|
||||||
this.hideDuplicateRows = hideDuplicateRows;
|
this.hideDuplicateRows = hideDuplicateRows;
|
||||||
this.hideReduntantPrefabVariantLinks = hideReduntantPrefabVariantLinks;
|
|
||||||
|
|
||||||
highlightedSearchTextColor = "<color=#" + ColorUtility.ToHtmlStringRGBA( AssetUsageDetectorSettings.SearchMatchingTextColor ) + ">";
|
highlightedSearchTextColor = "<color=#" + ColorUtility.ToHtmlStringRGBA( AssetUsageDetectorSettings.SearchMatchingTextColor ) + ">";
|
||||||
|
|
||||||
@@ -993,7 +991,7 @@ namespace AssetUsageDetectorNamespace
|
|||||||
return referenceNodes.Contains( GetDataFromId( item.id ).node );
|
return referenceNodes.Contains( GetDataFromId( item.id ).node );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HideItems( IList<int> ids )
|
public void HideItems( IList<int> ids )
|
||||||
{
|
{
|
||||||
if( ids.Count > 0 )
|
if( ids.Count > 0 )
|
||||||
{
|
{
|
||||||
@@ -1158,7 +1156,7 @@ namespace AssetUsageDetectorNamespace
|
|||||||
|
|
||||||
if( selectedNodes.Count > 0 )
|
if( selectedNodes.Count > 0 )
|
||||||
{
|
{
|
||||||
SearchResultTreeView isolatedTreeView = new SearchResultTreeView( new SearchResultTreeViewState(), selectedNodes, TreeType.IsolatedView, null, hideDuplicateRows, hideReduntantPrefabVariantLinks, false );
|
SearchResultTreeView isolatedTreeView = new SearchResultTreeView( new SearchResultTreeViewState(), selectedNodes, TreeType.IsolatedView, null, hideDuplicateRows, false );
|
||||||
isolatedTreeView.ExpandMainReferences();
|
isolatedTreeView.ExpandMainReferences();
|
||||||
|
|
||||||
SearchResultTreeViewIsolatedView.Show( new Vector2( EditorWindow.focusedWindow.position.width, Mathf.Max( isolatedTreeView.totalHeight, EditorGUIUtility.singleLineHeight * 5f ) + 1f ), isolatedTreeView, new GUIContent( selectedNodes[0].Label + ( selectedNodes.Count <= 1 ? "" : ( " (and " + ( selectedNodes.Count - 1 ) + " more)" ) ) ) );
|
SearchResultTreeViewIsolatedView.Show( new Vector2( EditorWindow.focusedWindow.position.width, Mathf.Max( isolatedTreeView.totalHeight, EditorGUIUtility.singleLineHeight * 5f ) + 1f ), isolatedTreeView, new GUIContent( selectedNodes[0].Label + ( selectedNodes.Count <= 1 ? "" : ( " (and " + ( selectedNodes.Count - 1 ) + " more)" ) ) ) );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
= Asset Usage Detector (v2.5.1) =
|
= Asset Usage Detector (v2.5.4) =
|
||||||
|
|
||||||
Documentation: https://github.com/yasirkula/UnityAssetUsageDetector
|
Documentation: https://github.com/yasirkula/UnityAssetUsageDetector
|
||||||
E-mail: yasirkula@gmail.com
|
E-mail: yasirkula@gmail.com
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.yasirkula.assetusagedetector",
|
"name": "com.yasirkula.assetusagedetector",
|
||||||
"displayName": "Asset Usage Detector",
|
"displayName": "Asset Usage Detector",
|
||||||
"version": "2.5.1",
|
"version": "2.5.4",
|
||||||
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
|
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
|
||||||
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
|
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
|
||||||
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",
|
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",
|
||||||
|
|||||||
Reference in New Issue
Block a user