Example #1
0
        private void DrawHeader()
        {
            using (new GUILayout.HorizontalScope())
            {
                using (new GUILayout.VerticalScope())
                {
                    GUILayout.Label("<size=13>Here you may check any project assets for all project references.</size>", UIHelpers.richWordWrapLabel);

                    if (UIHelpers.ImageButton("Find all assets references",
                                              "Traverses whole project to find where all assets are referenced.", CSIcons.Find))
                    {
                        if (Event.current.control && Event.current.shift)
                        {
                            ReferencesFinder.debugMode = true;
                            AssetsMap.Delete();
                            Event.current.Use();
                        }
                        else
                        {
                            ReferencesFinder.debugMode = false;
                        }
                        EditorApplication.delayCall += StartProjectReferencesScan;
                    }

                    if (ReferencesFinder.GetSelectedAssets().Length == 0)
                    {
                        GUI.enabled = false;
                    }
                    if (UIHelpers.ImageButton("Find selected assets references",
                                              "Adds selected Project View assets to the current search results.", CSIcons.Find))
                    {
                        EditorApplication.delayCall += () => ReferencesFinder.AddSelectedToSelectionAndRun();
                    }
                    GUI.enabled = true;
                }

                GUILayout.Space(30);

                using (new GUILayout.VerticalScope(UIHelpers.panelWithBackground, GUILayout.Width(250)))
                {
                    GUILayout.Space(5);
                    using (new GUILayout.HorizontalScope())
                    {
                        GUILayout.Space(3);
                        if (UIHelpers.ImageButton("Manage Filters... (" + MaintainerSettings.References.pathIgnoresFilters.Length + ")",
                                                  CSIcons.Gear, GUILayout.ExpandWidth(false)))
                        {
                            ReferencesFiltersWindow.Create();
                        }
                        GUILayout.FlexibleSpace();
                        if (UIHelpers.ImageButton(null, "Show some extra info and notes about " + ReferencesFinder.ModuleName + ".", CSIcons.HelpOutline, GUILayout.ExpandWidth(false)))
                        {
                            EditorUtility.DisplayDialog(ReferencesFinder.ModuleName + " Extra Info",
                                                        "Except buttons on this tab, you may use these commands to search for references:\n\n" +
                                                        "Search for asset references from the Project Browser context menu:\n" +
                                                        MaintainerMenu.ProjectBrowserContextReferencesFinderName + "\n\n" +
                                                        "Look for the MonoBehaviour and ScriptableObject references from the Components' or ScriptableObjects' context menus\n" +
                                                        MaintainerMenu.ScriptReferencesContextMenuName + "\n\n" +
                                                        "Or just drag && drop items from Project Browser or Inspector to the list." + "\n\n" +
                                                        "Note #1: you'll see only those references which Maintainer was able to figure out. " +
                                                        "Some kinds of references can't be statically found or not supported yet." + "\n\n" +
                                                        "Note #2: not referenced assets still may be used at runtime or from Editor scripting.", "OK");
                        }

                        GUILayout.Space(3);
                    }

                    MaintainerPersonalSettings.References.showAssetsWithoutReferences = GUILayout.Toggle(
                        MaintainerPersonalSettings.References.showAssetsWithoutReferences,
                        new GUIContent("Add assets without found references", "Check to see all scanned assets in the list even if there was no any references to the asset found in project."), GUILayout.ExpandWidth(false));

                    MaintainerPersonalSettings.References.selectedFindClearsResults = GUILayout.Toggle(
                        MaintainerPersonalSettings.References.selectedFindClearsResults,
                        new GUIContent(@"Clear results on selected assets search", "Check to automatically clear last results on selected assets find both from context menu and main window.\nUncheck to add new results to the last results."), GUILayout.ExpandWidth(false));

                    GUILayout.Space(3);
                }
            }
        }
Example #2
0
 public static void FindReferences()
 {
     ReferencesFinder.AddSelectedToSelectionAndRun();
 }