示例#1
0
        private void Search(Func <FileInfo, bool> searchAction)
        {
            var foundFiles = new List <string>();

            ReferenceSearchUtility.ExecuteAssetSearchAtPath(settings.path, ".asset", (file) =>
            {
                if (searchAction(file))
                {
                    foundFiles.Add(GetProjectRelativePath(file.FullName));
                }
            });

            //Get Assets for found files
            var assets = new List <UnityEngine.Object>();

            for (int i = 0; i < foundFiles.Count; i++)
            {
                var path = foundFiles[i];
                EditorUtility.DisplayProgressBar("Fetching Asset References", path, i / (float)foundFiles.Count);
                assets.Add(AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(path));
            }

            EditorUtility.ClearProgressBar();

            SearchResultWindow.SetFiles(assets, assetFile);
        }
示例#2
0
        public static void SearchEverywhere()
        {
            var window       = GetWindow();
            var searchTarget = Selection.activeObject;

            window.SearchForAsset(searchTarget);
            SearchResultWindow.SearchForFileInAllScenes(searchTarget);
        }