private void doSearchAndReplace()
        {
            if (currentSearch.CanSearchAndReplace(searchOptions))
            {
                SearchOptions options = searchOptions.Copy();
                options.searchType = SearchType.SearchAndReplace;

                searchJob = new SearchJob(currentSearch, options, currentSearch.searchScope.ToData(options));
                searchJob.AddAssets(SearchAssetFactory.GetAssets(currentSearch.searchScope.ToData(options)));
                EditorCoroutineUtility.StartCoroutine(searchJob.ExecuteAsync(), this);
            }
        }
Beispiel #2
0
        private IEnumerator searchDependencies(UnityEngine.Object[] rootObjects)
        {
            if (rootObjects == null || rootObjects.Length == 0)
            {
                yield break;
            }

            if (!scope.searchDependencies)
            {
                yield break;
            }
            if (scope.assetScope == SearchScope.allAssets && scope.projectScope == ProjectScope.EntireProject)
            {
                // We are searching literally everything we can, so no need to load
                // things more.
                yield break;
            }
            //search dependencies
            UnityEngine.Object[] dependencies = EditorUtility.CollectDependencies(rootObjects);

            foreach (UnityEngine.Object dependency in dependencies)
            {
                string path = AssetDatabase.GetAssetPath(dependency);

                if (!searchAssetsData.ContainsKey(path))
                {
                    // empty strings mean it is local object.
                    if (path != string.Empty)
                    {
                        // do we support this file extension?
                        if (isSearchable(path))
                        {
                            SearchAssetData dependencyAsset = SearchAssetFactory.AssetForPath(path);
                            if (dependencyAsset != null)
                            {
                                searchAssetsData[path] = dependencyAsset;
                                dependencyAssets.Add(dependencyAsset);

                                searchAsset(dependencyAsset);
                                dependencyAsset.Unload();
                                yield return(null);
                            }
                        }
                    }
                }
            }
        }