public SearchResult(bool success, List <SearchResultGroup> result, SceneSetup[] initialSceneSetup, AssetUsageDetector searchHandler, AssetUsageDetector.Parameters searchParameters)
        {
            if (result == null)
            {
                result = new List <SearchResultGroup>(0);
            }

            this.success            = success;
            this.result             = result;
            this.initialSceneSetup  = initialSceneSetup;
            this.searchHandler      = searchHandler;
            this.m_searchParameters = searchParameters;
        }
        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;
            }
        }