private void InitiateSearch()
        {
            if (objectsToSearch.IsEmpty())
            {
                errorMessage = "ADD AN ASSET TO THE LIST FIRST!";
            }
            else if (!EditorApplication.isPlaying && !Utilities.AreScenesSaved())
            {
                // Don't start the search if at least one scene is currently dirty (not saved)
                errorMessage = "SAVE OPEN SCENES FIRST!";
            }
            else
            {
                errorMessage = string.Empty;
                currentPhase = Phase.Processing;

                SavePrefs();

#if UNITY_2018_3_OR_NEWER
                ReplacePrefabStageObjectsWithAssets(PrefabStageUtility.GetCurrentPrefabStage());
#endif

                // Start searching
                searchResult = core.Run(new AssetUsageDetector.Parameters()
                {
                    objectsToSearch          = new ObjectToSearchEnumerator(objectsToSearch).ToArray(),
                    searchInScenes           = GetSceneSearchMode(true),
                    searchInAssetsFolder     = searchInAssetsFolder,
                    searchInAssetsSubset     = !searchInAssetsSubset.IsEmpty() ? searchInAssetsSubset.ToArray() : null,
                    excludedAssetsFromSearch = !excludedAssets.IsEmpty() ? excludedAssets.ToArray() : null,
                    dontSearchInSourceAssets = dontSearchInSourceAssets,
                    excludedScenesFromSearch = !excludedScenes.IsEmpty() ? excludedScenes.ToArray() : null,
                    searchInProjectSettings  = searchInProjectSettings,
                    //fieldModifiers = fieldModifiers,
                    //propertyModifiers = propertyModifiers,
                    //searchDepthLimit = searchDepthLimit,
                    //searchNonSerializableVariables = searchNonSerializableVariables,
                    lazySceneSearch         = lazySceneSearch,
                    noAssetDatabaseChanges  = noAssetDatabaseChanges,
                    showDetailedProgressBar = showDetailedProgressBar
                });

                currentPhase = Phase.Complete;
            }
        }
        public void RefreshSearchResultGroup(SearchResultGroup searchResultGroup, bool noAssetDatabaseChanges)
        {
            if (searchResultGroup == null)
            {
                Debug.LogError("SearchResultGroup is null!");
                return;
            }

            int searchResultGroupIndex = -1;

            for (int i = 0; i < result.Count; i++)
            {
                if (result[i] == searchResultGroup)
                {
                    searchResultGroupIndex = i;
                    break;
                }
            }

            if (searchResultGroupIndex < 0)
            {
                Debug.LogError("SearchResultGroup is not a part of SearchResult!");
                return;
            }

            if (searchResultGroup.Type == SearchResultGroup.GroupType.Scene && EditorApplication.isPlaying && !EditorSceneManager.GetSceneByPath(searchResultGroup.Title).isLoaded)
            {
                Debug.LogError("Can't search unloaded scene while in Play Mode!");
                return;
            }

            if (searchHandler == null)
            {
                searchHandler = new AssetUsageDetector();
            }

            SceneSearchMode searchInScenes = m_searchParameters.searchInScenes;

            Object[] searchInScenesSubset = m_searchParameters.searchInScenesSubset;
            bool     searchInAssetsFolder = m_searchParameters.searchInAssetsFolder;

            Object[] searchInAssetsSubset = m_searchParameters.searchInAssetsSubset;

            try
            {
                if (searchResultGroup.Type == SearchResultGroup.GroupType.Assets)
                {
                    m_searchParameters.searchInScenes       = SceneSearchMode.None;
                    m_searchParameters.searchInScenesSubset = null;
                }
                else if (searchResultGroup.Type == SearchResultGroup.GroupType.Scene)
                {
                    m_searchParameters.searchInScenes       = SceneSearchMode.None;
                    m_searchParameters.searchInScenesSubset = new Object[1] {
                        AssetDatabase.LoadAssetAtPath <SceneAsset>(searchResultGroup.Title)
                    };
                    m_searchParameters.searchInAssetsFolder = false;
                    m_searchParameters.searchInAssetsSubset = null;
                }
                else
                {
                    m_searchParameters.searchInScenes       = (SceneSearchMode)1024;                // A unique value to search only the DontDestroyOnLoad scene
                    m_searchParameters.searchInScenesSubset = null;
                    m_searchParameters.searchInAssetsFolder = false;
                    m_searchParameters.searchInAssetsSubset = null;
                }

                m_searchParameters.lazySceneSearch        = false;
                m_searchParameters.noAssetDatabaseChanges = noAssetDatabaseChanges;

                // Make sure the AssetDatabase is up-to-date
                AssetDatabase.SaveAssets();

                List <SearchResultGroup> searchResult = searchHandler.Run(m_searchParameters).result;
                if (searchResult != null)
                {
                    int newSearchResultGroupIndex = -1;
                    for (int i = 0; i < searchResult.Count; i++)
                    {
                        if (searchResultGroup.Title == searchResult[i].Title)
                        {
                            newSearchResultGroupIndex = i;
                            break;
                        }
                    }

                    if (newSearchResultGroupIndex >= 0)
                    {
                        result[searchResultGroupIndex] = searchResult[newSearchResultGroupIndex];
                    }
                    else
                    {
                        searchResultGroup.Clear();
                    }
                }
            }
            finally
            {
                m_searchParameters.searchInScenes       = searchInScenes;
                m_searchParameters.searchInScenesSubset = searchInScenesSubset;
                m_searchParameters.searchInAssetsFolder = searchInAssetsFolder;
                m_searchParameters.searchInAssetsSubset = searchInAssetsSubset;
            }
        }