Compare commits

..

4 Commits

Author SHA1 Message Date
Süleyman Yasir KULA bc3a8069b4 - Project Settings are now searched for references
- Fixed #20
2020-06-27 00:18:45 +03:00
Süleyman Yasir KULA 98d1f43180 References to "SceneAsset"s are now found (fixes #22) 2020-06-16 18:46:22 +03:00
Süleyman Yasir KULA 7d24aa4939 Update package.json 2020-05-29 21:23:42 +03:00
Süleyman Yasir KULA c16bef45cd - Assembly Definition Files' "Assembly Definition References" are now included in the search
- Refreshing the "Project Window (Assets)" group in search results page wasn't working sometimes, fixed
- Tooltips were hard to see in 2019.3+, fixed
2020-05-29 15:27:21 +03:00
7 changed files with 215 additions and 27 deletions
+1
View File
@@ -28,6 +28,7 @@ There are 5 ways to install this plugin:
- Open **Window - Asset Usage Detector** window, configure the settings and hit **GO!**
- or, right click an object and select **Search For References**
- In the search results page, each row represents a reference to the searched Object(s). Rows can be traversed from left to right to see how the references are formed. If a node's label contains text inside square brackets (e.g. *\[Child object\]*), then that text describes how that node is connected to the node to its left
## FEATURES
@@ -14,10 +14,13 @@ using UnityEngine.UI;
using System.Text;
#if UNITY_2017_1_OR_NEWER
using UnityEngine.U2D;
using UnityEngine.Playables;
#endif
#if UNITY_2018_2_OR_NEWER
using UnityEditor.U2D;
#endif
using UnityEngine.Playables;
#if UNITY_2017_3_OR_NEWER
using UnityEditor.Compilation;
#endif
#if UNITY_2017_2_OR_NEWER
using UnityEngine.Tilemaps;
@@ -40,11 +43,12 @@ namespace AssetUsageDetectorNamespace
public SceneSearchMode searchInScenes = SceneSearchMode.AllScenes;
public Object[] searchInScenesSubset = null;
public Object[] excludedScenesFromSearch = null;
public bool searchInAssetsFolder = true;
public Object[] searchInAssetsSubset = null;
public Object[] excludedAssetsFromSearch = null;
public bool dontSearchInSourceAssets = true;
public Object[] excludedScenesFromSearch = null;
public bool searchInProjectSettings = true;
public int searchDepthLimit = 4;
public BindingFlags fieldModifiers = BindingFlags.Public | BindingFlags.NonPublic;
@@ -104,6 +108,17 @@ namespace AssetUsageDetectorNamespace
}
}
}
#if UNITY_2017_3_OR_NEWER
#pragma warning disable 0649 // The fields' values are assigned via JsonUtility
[Serializable]
private struct AssemblyDefinitionReferences
{
public string reference; // Used by AssemblyDefinitionReferenceAssets
public List<string> references; // Used by AssemblyDefinitionAssets
}
#pragma warning restore 0649
#endif
#endregion
// A set that contains the searched asset(s) and their sub-assets (if any)
@@ -123,6 +138,11 @@ namespace AssetUsageDetectorNamespace
// Path(s) of the assets that should be excluded from the search
private readonly HashSet<string> excludedAssetsPathsSet = new HashSet<string>();
#if UNITY_2017_3_OR_NEWER
// Path(s) of the Assembly Definition Files in objectsToSearchSet (Value: files themselves)
private readonly Dictionary<string, Object> assemblyDefinitionFilesToSearch = new Dictionary<string, Object>( 8 );
#endif
// Results for the currently searched scene
private SearchResultGroup currentSearchResultGroup;
@@ -258,6 +278,9 @@ namespace AssetUsageDetectorNamespace
assetsToSearchPathsSet.Clear();
assetsToSearchRootPrefabs.Clear();
excludedAssetsPathsSet.Clear();
#if UNITY_2017_3_OR_NEWER
assemblyDefinitionFilesToSearch.Clear();
#endif
if( assetDependencyCache == null )
{
@@ -291,6 +314,12 @@ namespace AssetUsageDetectorNamespace
{ typeof( AnimationClip ), SearchAnimationClip },
#if UNITY_2017_1_OR_NEWER
{ typeof( SpriteAtlas ), SearchSpriteAtlas },
#endif
#if UNITY_2017_3_OR_NEWER
{ typeof( UnityEditorInternal.AssemblyDefinitionAsset ), SearchAssemblyDefinitionFile },
#endif
#if UNITY_2019_2_OR_NEWER
{ typeof( UnityEditorInternal.AssemblyDefinitionReferenceAsset ), SearchAssemblyDefinitionFile },
#endif
};
}
@@ -360,7 +389,7 @@ namespace AssetUsageDetectorNamespace
// Find the scenes to search for references
HashSet<string> scenesToSearch = new HashSet<string>();
if( searchParameters.searchInScenesSubset != null )
if( searchParameters.searchInScenesSubset != null && searchParameters.searchInScenesSubset.Length > 0 )
{
foreach( Object obj in searchParameters.searchInScenesSubset )
{
@@ -439,6 +468,17 @@ namespace AssetUsageDetectorNamespace
} );
}
// Find Project Settings to search for references
// Don't search Project Settings if searched object(s) are all scene objects as Project Settings can't hold references to scene objects
string[] projectSettingsToSearch = new string[0];
if( searchParameters.searchInProjectSettings && assetsToSearchSet.Count > 0 )
{
string[] projectSettingsFiles = Directory.GetFiles( "ProjectSettings" );
projectSettingsToSearch = new string[projectSettingsFiles.Length];
for( int i = 0; i < projectSettingsFiles.Length; i++ )
projectSettingsToSearch[i] = "ProjectSettings/" + Path.GetFileName( projectSettingsFiles[i] );
}
// Initialize the nodes of searched asset(s)
foreach( Object obj in objectsToSearchSet )
searchedObjects.Add( obj.Hash(), PopReferenceNode( obj ) );
@@ -449,6 +489,9 @@ namespace AssetUsageDetectorNamespace
if( isInPlayMode && searchParameters.searchInScenes != SceneSearchMode.None )
searchTotalProgress++; // DontDestroyOnLoad scene
if( searchParameters.showDetailedProgressBar )
searchTotalProgress += projectSettingsToSearch.Length;
// Don't search assets if searched object(s) are all scene objects as assets can't hold references to scene objects
if( searchParameters.searchInAssetsFolder && assetsToSearchSet.Count > 0 )
{
@@ -456,7 +499,7 @@ namespace AssetUsageDetectorNamespace
// Get the paths of all assets that are to be searched
IEnumerable<string> assetPaths;
if( searchParameters.searchInAssetsSubset == null )
if( searchParameters.searchInAssetsSubset == null || searchParameters.searchInAssetsSubset.Length == 0 )
{
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();
assetPaths = allAssetPaths;
@@ -506,6 +549,25 @@ namespace AssetUsageDetectorNamespace
}
}
#if UNITY_2017_3_OR_NEWER
if( assemblyDefinitionFilesToSearch.Count > 0 )
{
// AssetDatabase.GetDependencies doesn't return references from Assembly Definition Files to their Assembly Definition References,
// so if we are searching for an Assembly Definition File's usages, we must search all Assembly Definition Files' references
// manually. By adding all these files to assetsToSearchPathsSet, we make sure that AssetHasAnyReference returns true for
// these assets and they don't get excluded from the search
string[] assemblyDefinitionFilesGuids = AssetDatabase.FindAssets( "t:AssemblyDefinitionAsset" );
for( int i = 0; i < assemblyDefinitionFilesGuids.Length; i++ )
assetsToSearchPathsSet.Add( AssetDatabase.GUIDToAssetPath( assemblyDefinitionFilesGuids[i] ) );
#if UNITY_2019_2_OR_NEWER
assemblyDefinitionFilesGuids = AssetDatabase.FindAssets( "t:AssemblyDefinitionReferenceAsset" );
for( int i = 0; i < assemblyDefinitionFilesGuids.Length; i++ )
assetsToSearchPathsSet.Add( AssetDatabase.GUIDToAssetPath( assemblyDefinitionFilesGuids[i] ) );
#endif
}
#endif
if( EditorUtility.DisplayCancelableProgressBar( "Please wait...", "Searching assets", 0f ) )
throw new Exception( "Search aborted" );
@@ -543,6 +605,31 @@ namespace AssetUsageDetectorNamespace
searchResult.Add( currentSearchResultGroup );
}
// Search all assets inside ProjectSettings folder
if( projectSettingsToSearch.Length > 0 )
{
currentSearchResultGroup = new SearchResultGroup( "Project Settings", SearchResultGroup.GroupType.ProjectSettings );
if( EditorUtility.DisplayCancelableProgressBar( "Please wait...", "Searching Project Settings", (float) searchProgress / searchTotalProgress ) )
throw new Exception( "Search aborted" );
for( int i = 0; i < projectSettingsToSearch.Length; i++ )
{
if( searchParameters.showDetailedProgressBar && ++searchProgress % 30 == 1 && EditorUtility.DisplayCancelableProgressBar( "Please wait...", "Searching Project Settings", (float) searchProgress / searchTotalProgress ) )
throw new Exception( "Search aborted" );
Object[] assets = AssetDatabase.LoadAllAssetsAtPath( projectSettingsToSearch[i] );
if( assets != null && assets.Length > 0 )
{
for( int j = 0; j < assets.Length; j++ )
BeginSearchObject( assets[j] );
}
}
if( currentSearchResultGroup.NumberOfReferences > 0 )
searchResult.Add( currentSearchResultGroup );
}
// Search non-serializable variables for references while searching a scene in play mode
if( isInPlayMode )
searchSerializableVariablesOnly = false;
@@ -594,7 +681,7 @@ namespace AssetUsageDetectorNamespace
// Search through all the GameObjects under the DontDestroyOnLoad scene (if exists)
if( isInPlayMode && searchParameters.searchInScenes != SceneSearchMode.None )
{
if( searchParameters.showDetailedProgressBar && EditorUtility.DisplayCancelableProgressBar( "Please wait...", "Searching scene: DontDestroyOnLoad", 1f ) )
if( EditorUtility.DisplayCancelableProgressBar( "Please wait...", "Searching scene: DontDestroyOnLoad", 1f ) )
throw new Exception( "Search aborted" );
currentSearchResultGroup = new SearchResultGroup( "DontDestroyOnLoad", SearchResultGroup.GroupType.DontDestroyOnLoad );
@@ -706,9 +793,6 @@ namespace AssetUsageDetectorNamespace
if( obj == null || obj.Equals( null ) )
return;
if( obj is SceneAsset )
return;
objectsToSearchSet.Add( obj );
#if UNITY_2018_3_OR_NEWER
@@ -760,6 +844,13 @@ namespace AssetUsageDetectorNamespace
if( shouldAddRootPrefabEntry )
assetsToSearchRootPrefabs.Add( go );
}
#if UNITY_2017_3_OR_NEWER
else if( obj is UnityEditorInternal.AssemblyDefinitionAsset )
{
if( !string.IsNullOrEmpty( assetPath ) )
assemblyDefinitionFilesToSearch[assetPath] = obj;
}
#endif
}
else
{
@@ -914,10 +1005,21 @@ namespace AssetUsageDetectorNamespace
if( unityObject != null )
{
// If the Object is an asset, search it in detail only if its dependencies contain at least one of the searched asset(s)
if( unityObject.IsAsset() && ( assetsToSearchSet.Count == 0 || !AssetHasAnyReference( AssetDatabase.GetAssetPath( unityObject ) ) ) )
if( unityObject.IsAsset() )
{
searchedObjects.Add( objHash, null );
return null;
if( assetsToSearchSet.Count == 0 )
{
searchedObjects.Add( objHash, null );
return null;
}
// AssetHasAnyReference always returns false for Project Settings assets, ignore its result for them
string assetPath = AssetDatabase.GetAssetPath( unityObject );
if( !assetPath.StartsWith( "ProjectSettings/" ) && !AssetHasAnyReference( assetPath ) )
{
searchedObjects.Add( objHash, null );
return null;
}
}
callStack.Add( unityObject );
@@ -931,7 +1033,7 @@ namespace AssetUsageDetectorNamespace
else
{
result = PopReferenceNode( unityObject );
SearchWithSerializedObject( result );
SearchVariablesWithSerializedObject( result );
}
callStack.RemoveAt( callStack.Count - 1 );
@@ -946,7 +1048,7 @@ namespace AssetUsageDetectorNamespace
currentDepth++;
result = PopReferenceNode( obj );
SearchFieldsAndPropertiesOf( result );
SearchVariablesWithReflection( result );
currentDepth--;
callStack.RemoveAt( callStack.Count - 1 );
@@ -1069,7 +1171,7 @@ namespace AssetUsageDetectorNamespace
}
#endif
SearchWithSerializedObject( referenceNode );
SearchVariablesWithSerializedObject( referenceNode );
return referenceNode;
}
@@ -1251,6 +1353,43 @@ namespace AssetUsageDetectorNamespace
}
#endif
#if UNITY_2017_3_OR_NEWER
// Find references from an Assembly Definition File to its Assembly Definition References
private ReferenceNode SearchAssemblyDefinitionFile( Object unityObject )
{
if( assemblyDefinitionFilesToSearch.Count == 0 )
return null;
AssemblyDefinitionReferences assemblyDefinitionFile = JsonUtility.FromJson<AssemblyDefinitionReferences>( ( (TextAsset) unityObject ).text );
ReferenceNode referenceNode = PopReferenceNode( unityObject );
if( !string.IsNullOrEmpty( assemblyDefinitionFile.reference ) )
{
if( assemblyDefinitionFile.references == null )
assemblyDefinitionFile.references = new List<string>( 1 ) { assemblyDefinitionFile.reference };
else
assemblyDefinitionFile.references.Add( assemblyDefinitionFile.reference );
}
if( assemblyDefinitionFile.references != null )
{
for( int i = 0; i < assemblyDefinitionFile.references.Count; i++ )
{
#if UNITY_2019_1_OR_NEWER
string assemblyPath = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyReference( assemblyDefinitionFile.references[i] );
#else
string assemblyPath = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName( assemblyDefinitionFile.references[i] );
#endif
Object searchedAssemblyDefinitionFile;
if( assemblyDefinitionFilesToSearch.TryGetValue( assemblyPath, out searchedAssemblyDefinitionFile ) )
referenceNode.AddLinkTo( GetReferenceNode( searchedAssemblyDefinitionFile ), "Referenced Assembly" );
}
}
return referenceNode;
}
#endif
// Find references from an Animation/Animator component to the objects that it animates
private void SearchAnimatedObjects( ReferenceNode referenceNode )
{
@@ -1330,8 +1469,8 @@ namespace AssetUsageDetectorNamespace
}
}
// Search through field and properties of an object for references with SerializedObject
private void SearchWithSerializedObject( ReferenceNode referenceNode )
// Search through variables of an object with SerializedObject
private void SearchVariablesWithSerializedObject( ReferenceNode referenceNode )
{
if( !isInPlayMode || referenceNode.nodeObject.IsAsset() )
{
@@ -1378,11 +1517,11 @@ namespace AssetUsageDetectorNamespace
}
// Use reflection algorithm as fallback
SearchFieldsAndPropertiesOf( referenceNode );
SearchVariablesWithReflection( referenceNode );
}
// Search through field and properties of an object for references
private void SearchFieldsAndPropertiesOf( ReferenceNode referenceNode )
// Search through variables of an object with reflection
private void SearchVariablesWithReflection( ReferenceNode referenceNode )
{
// Get filtered variables for this object
VariableGetterHolder[] variables = GetFilteredVariablesForType( referenceNode.nodeObject.GetType() );
@@ -16,6 +16,7 @@ namespace AssetUsageDetectorNamespace
private const string PREFS_SEARCH_SCENES = "AUD_SceneSearch";
private const string PREFS_SEARCH_ASSETS = "AUD_AssetsSearch";
private const string PREFS_SEARCH_PROJECT_SETTINGS = "AUD_ProjectSettingsSearch";
private const string PREFS_DONT_SEARCH_SOURCE_ASSETS = "AUD_AssetsExcludeSrc";
private const string PREFS_SEARCH_DEPTH_LIMIT = "AUD_Depth";
private const string PREFS_SEARCH_FIELDS = "AUD_Fields";
@@ -42,6 +43,7 @@ namespace AssetUsageDetectorNamespace
private bool searchInAllScenes = true; // All scenes (including scenes that are not in build)
private bool searchInAssetsFolder = true; // Assets in Project window
private bool dontSearchInSourceAssets = true; // objectsToSearch won't be searched for internal references
private bool searchInProjectSettings = true; // Player Settings, Graphics Settings etc.
private List<Object> searchInAssetsSubset = new List<Object>() { null }; // If not empty, only these assets are searched for references
private List<Object> excludedAssets = new List<Object>() { null }; // These assets won't be searched for references
@@ -186,6 +188,7 @@ namespace AssetUsageDetectorNamespace
mainWindow.ParseSceneSearchMode( searchParameters.searchInScenes );
mainWindow.searchInAssetsFolder = searchParameters.searchInAssetsFolder;
mainWindow.dontSearchInSourceAssets = searchParameters.dontSearchInSourceAssets;
mainWindow.searchInProjectSettings = searchParameters.searchInProjectSettings;
mainWindow.searchDepthLimit = searchParameters.searchDepthLimit;
mainWindow.fieldModifiers = searchParameters.fieldModifiers;
mainWindow.propertyModifiers = searchParameters.propertyModifiers;
@@ -269,6 +272,7 @@ namespace AssetUsageDetectorNamespace
EditorPrefs.SetInt( PREFS_SEARCH_SCENES, (int) GetSceneSearchMode( false ) );
EditorPrefs.SetBool( PREFS_SEARCH_ASSETS, searchInAssetsFolder );
EditorPrefs.SetBool( PREFS_DONT_SEARCH_SOURCE_ASSETS, dontSearchInSourceAssets );
EditorPrefs.SetBool( PREFS_SEARCH_PROJECT_SETTINGS, searchInProjectSettings );
EditorPrefs.SetInt( PREFS_SEARCH_DEPTH_LIMIT, searchDepthLimit );
EditorPrefs.SetInt( PREFS_SEARCH_FIELDS, (int) fieldModifiers );
EditorPrefs.SetInt( PREFS_SEARCH_PROPERTIES, (int) propertyModifiers );
@@ -285,6 +289,7 @@ namespace AssetUsageDetectorNamespace
searchInAssetsFolder = EditorPrefs.GetBool( PREFS_SEARCH_ASSETS, true );
dontSearchInSourceAssets = EditorPrefs.GetBool( PREFS_DONT_SEARCH_SOURCE_ASSETS, true );
searchInProjectSettings = EditorPrefs.GetBool( PREFS_SEARCH_PROJECT_SETTINGS, true );
searchDepthLimit = EditorPrefs.GetInt( PREFS_SEARCH_DEPTH_LIMIT, 4 );
// Fetch public, protected and private non-static fields and properties from objects by default
@@ -378,8 +383,13 @@ namespace AssetUsageDetectorNamespace
GUILayout.Space( 10 );
Color c = GUI.color;
GUI.color = Color.cyan;
GUILayout.Box( "SEARCH IN", Utilities.BoxGUIStyle, Utilities.GL_EXPAND_WIDTH );
GUI.color = c;
searchInAssetsFolder = EditorGUILayout.ToggleLeft( "Project window (Assets folder)", searchInAssetsFolder );
if( searchInAssetsFolder )
@@ -397,7 +407,7 @@ namespace AssetUsageDetectorNamespace
GUILayout.EndHorizontal();
}
GUILayout.Space( 10 );
Utilities.DrawSeparatorLine();
if( searchInAllScenes && !EditorApplication.isPlaying )
GUI.enabled = false;
@@ -433,6 +443,10 @@ namespace AssetUsageDetectorNamespace
GUILayout.EndVertical();
GUILayout.EndHorizontal();
Utilities.DrawSeparatorLine();
searchInProjectSettings = EditorGUILayout.ToggleLeft( "Project Settings (Player Settings, Graphics Settings etc.)", searchInProjectSettings );
GUILayout.Space( 10 );
//GUILayout.Box( "SEARCH SETTINGS", Utilities.BoxGUIStyle, Utilities.GL_EXPAND_WIDTH );
@@ -487,8 +501,12 @@ namespace AssetUsageDetectorNamespace
//GUILayout.Space( 10 );
GUI.color = Color.cyan;
GUILayout.Box( "SETTINGS", Utilities.BoxGUIStyle, Utilities.GL_EXPAND_WIDTH );
GUI.color = c;
lazySceneSearch = EditorGUILayout.ToggleLeft( "Lazy scene search: scenes are searched in detail only when they are manually refreshed (faster search)", lazySceneSearch );
noAssetDatabaseChanges = EditorGUILayout.ToggleLeft( "I haven't modified any assets/scenes since the last search (faster search)", noAssetDatabaseChanges );
showDetailedProgressBar = EditorGUILayout.ToggleLeft( "Show detailed progress bar (slower search)", showDetailedProgressBar );
@@ -496,11 +514,14 @@ namespace AssetUsageDetectorNamespace
GUILayout.Space( 10 );
// Don't let the user press the GO button without any valid search location
if( !searchInAllScenes && !searchInOpenScenes && !searchInScenesInBuild && !searchInAssetsFolder )
if( !searchInAllScenes && !searchInOpenScenes && !searchInScenesInBuild && !searchInAssetsFolder && !searchInProjectSettings )
GUI.enabled = false;
if( GUILayout.Button( "GO!", Utilities.GL_HEIGHT_30 ) )
{
InitiateSearch();
GUIUtility.ExitGUI();
}
}
else if( currentPhase == Phase.Complete )
{
@@ -564,7 +585,7 @@ namespace AssetUsageDetectorNamespace
noAssetDatabaseChanges = EditorGUILayout.ToggleLeft( "I haven't modified any assets/scenes since the last search (faster Refresh)", noAssetDatabaseChanges );
searchResultDrawParameters.noAssetDatabaseChanges = noAssetDatabaseChanges;
GUILayout.Space( 10 );
Utilities.DrawSeparatorLine();
GUILayout.Label( "Path drawing mode:" );
@@ -636,6 +657,7 @@ namespace AssetUsageDetectorNamespace
excludedAssetsFromSearch = !excludedAssets.IsEmpty() ? excludedAssets.ToArray() : null,
dontSearchInSourceAssets = dontSearchInSourceAssets,
excludedScenesFromSearch = !excludedScenes.IsEmpty() ? excludedScenes.ToArray() : null,
searchInProjectSettings = searchInProjectSettings,
//fieldModifiers = fieldModifiers,
//propertyModifiers = propertyModifiers,
//searchDepthLimit = searchDepthLimit,
@@ -127,6 +127,7 @@ namespace AssetUsageDetectorNamespace
Object[] searchInScenesSubset = m_searchParameters.searchInScenesSubset;
bool searchInAssetsFolder = m_searchParameters.searchInAssetsFolder;
Object[] searchInAssetsSubset = m_searchParameters.searchInAssetsSubset;
bool searchInProjectSettings = m_searchParameters.searchInProjectSettings;
try
{
@@ -134,6 +135,15 @@ namespace AssetUsageDetectorNamespace
{
m_searchParameters.searchInScenes = SceneSearchMode.None;
m_searchParameters.searchInScenesSubset = null;
m_searchParameters.searchInProjectSettings = false;
}
else if( searchResultGroup.Type == SearchResultGroup.GroupType.ProjectSettings )
{
m_searchParameters.searchInScenes = SceneSearchMode.None;
m_searchParameters.searchInScenesSubset = null;
m_searchParameters.searchInAssetsFolder = false;
m_searchParameters.searchInAssetsSubset = null;
m_searchParameters.searchInProjectSettings = true;
}
else if( searchResultGroup.Type == SearchResultGroup.GroupType.Scene )
{
@@ -141,6 +151,7 @@ namespace AssetUsageDetectorNamespace
m_searchParameters.searchInScenesSubset = new Object[1] { AssetDatabase.LoadAssetAtPath<SceneAsset>( searchResultGroup.Title ) };
m_searchParameters.searchInAssetsFolder = false;
m_searchParameters.searchInAssetsSubset = null;
m_searchParameters.searchInProjectSettings = false;
}
else
{
@@ -148,6 +159,7 @@ namespace AssetUsageDetectorNamespace
m_searchParameters.searchInScenesSubset = null;
m_searchParameters.searchInAssetsFolder = false;
m_searchParameters.searchInAssetsSubset = null;
m_searchParameters.searchInProjectSettings = false;
}
m_searchParameters.lazySceneSearch = false;
@@ -188,6 +200,7 @@ namespace AssetUsageDetectorNamespace
m_searchParameters.searchInScenesSubset = searchInScenesSubset;
m_searchParameters.searchInAssetsFolder = searchInAssetsFolder;
m_searchParameters.searchInAssetsSubset = searchInAssetsSubset;
m_searchParameters.searchInProjectSettings = searchInProjectSettings;
}
}
@@ -217,7 +230,7 @@ namespace AssetUsageDetectorNamespace
// To work nicely with GUILayout and scroll view
EditorGUILayout.GetControlRect( Utilities.GL_EXPAND_WIDTH, GUILayout.Height( guiHeight ) );
if( parameters.tooltip != null )
if( !string.IsNullOrEmpty( parameters.tooltip ) )
{
// Show tooltip at mouse position
Vector2 mousePos = Event.current.mousePosition;
@@ -413,7 +426,7 @@ namespace AssetUsageDetectorNamespace
// Custom class to hold the results for a single scene or Assets folder
public class SearchResultGroup
{
public enum GroupType { Assets = 0, Scene = 1, DontDestroyOnLoad = 2 };
public enum GroupType { Assets = 0, Scene = 1, DontDestroyOnLoad = 2, ProjectSettings = 3 };
// Custom struct to hold a single path to a reference
public struct ReferencePath
+10 -1
View File
@@ -57,6 +57,7 @@ namespace AssetUsageDetectorNamespace
public static readonly GUILayoutOption GL_WIDTH_100 = GUILayout.Width( 100 );
public static readonly GUILayoutOption GL_WIDTH_250 = GUILayout.Width( 250 );
public static readonly GUILayoutOption GL_HEIGHT_0 = GUILayout.Height( 0 );
public static readonly GUILayoutOption GL_HEIGHT_2 = GUILayout.Height( 2 );
public static readonly GUILayoutOption GL_HEIGHT_30 = GUILayout.Height( 30 );
public static readonly GUILayoutOption GL_HEIGHT_35 = GUILayout.Height( 35 );
public static readonly GUILayoutOption GL_HEIGHT_40 = GUILayout.Height( 40 );
@@ -99,12 +100,13 @@ namespace AssetUsageDetectorNamespace
normalState = m_tooltipGUIStyle.normal;
normalState.background = null;
normalState.scaledBackgrounds = new Texture2D[0];
normalState.textColor = Color.black;
}
if( normalState.background == null || normalState.background.Equals( null ) )
{
Texture2D backgroundTexture = new Texture2D( 1, 1 );
Texture2D backgroundTexture = new Texture2D( 1, 1 ) { hideFlags = HideFlags.HideAndDontSave };
backgroundTexture.SetPixel( 0, 0, new Color( 0.88f, 0.88f, 0.88f, 0.85f ) );
backgroundTexture.Apply();
@@ -473,6 +475,13 @@ namespace AssetUsageDetectorNamespace
return true;
}
public static void DrawSeparatorLine()
{
GUILayout.Space( 4 );
GUILayout.Box( "", GL_HEIGHT_2, GL_EXPAND_WIDTH );
GUILayout.Space( 4 );
}
public static bool ContainsFast<T>( this List<T> list, T element )
{
if( !( element is ValueType ) )
+4
View File
@@ -9,6 +9,10 @@ This tool helps you find usages of the selected asset(s) and/or Object(s) in you
2. HOW TO
Open "Window-Asset Usage Detector" window, configure the settings and hit GO! You can also right click an object and select "Search For References".
In the search results page, each row represents a reference to the searched Object(s). Rows can be traversed from left to right to see how the
references are formed. If a node's label contains text inside square brackets (e.g. [Child object]), then that text describes how that node is
connected to the node to its left.
3. KNOWN LIMITATIONS
- static variables are not searched
- GUIText materials are not searched
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "com.yasirkula.assetusagedetector",
"displayName": "Asset Usage Detector",
"version": "1.7.7",
"version": "1.8.0",
"description": "This editor extension helps you figure out at which places an asset or GameObject is used, i.e. lists the objects that refer to the asset. It is possible to search for references in the Assets folder (Project view) and/or in the scene(s) of your project. You can also search for references while in Play mode!"
}
}