private static bool LookForReferences(FilterItem[] selectedAssets, List <ReferencesTreeElement> results) { var canceled = !CSSceneTools.SaveCurrentModifiedScenes(false); if (!canceled) { var map = AssetsMap.GetUpdated(); if (map == null) { return(true); } var count = map.assets.Count; var updateStep = Math.Max(count / MaintainerSettings.UpdateProgressStep, 1); var root = new ReferencesTreeElement { id = results.Count, name = "root", depth = -1 }; results.Add(root); for (var i = 0; i < count; i++) { if (i % updateStep == 0 && EditorUtility.DisplayCancelableProgressBar( string.Format(ProgressCaption, 1, PhasesCount), string.Format(ProgressText, "Building references tree", i + 1, count), (float)i / count)) { canceled = true; break; } var assetInfo = map.assets[i]; // excludes settings assets from the list depth 0 items if (assetInfo.Kind == AssetKind.Settings) { continue; } // excludes all assets except selected ones from the list depth 0 items, if any was selected if (selectedAssets != null) { if (!CSFilterTools.IsValueMatchesAnyFilter(assetInfo.Path, selectedAssets)) { continue; } } if (MaintainerSettings.References.pathIncludesFilters != null && MaintainerSettings.References.pathIncludesFilters.Length > 0) { // excludes all root assets except included ones if (!CSFilterTools.IsValueMatchesAnyFilter(assetInfo.Path, MaintainerSettings.References.pathIncludesFilters)) { continue; } } // excludes ignored root asset if (CSFilterTools.IsValueMatchesAnyFilter(assetInfo.Path, MaintainerSettings.References.pathIgnoresFilters)) { continue; } var branchElements = new List <ReferencesTreeElement>(); TreeBuilder.BuildTreeBranch(assetInfo, 0, results.Count, branchElements); results.AddRange(branchElements); } } if (!canceled) { canceled = ReferenceEntryFinder.FillReferenceEntries(); } if (!canceled) { AssetsMap.Save(); } if (canceled) { ReferencesTab.AutoShowExistsNotification = false; ReferencesTab.AutoSelectPath = null; } return(canceled); }