private void DrawSelectionGridGUI()
        {
            GUILayout.Space(3);
            var windowRect = GUILayoutUtility.GetRect(1, WORD_HEIGHT);

            windowRect.x        += 4;
            windowRect.width    -= 7;
            _currentSearchSource = (ScriptSearch)GUI.SelectionGrid(windowRect, (int)_currentSearchSource, _checkType, _checkType.Length, EditorStyles.radioButton);
            if (_currentSearchSource != ScriptSearch.PrefabReferences)
            {
                _searchPrefabDependencies = GUILayout.Toggle(_searchPrefabDependencies, "Search prefab dependencies");
            }
        }
        private void DrawScriptSearchGUI()
        {
            switch (_currentSearchSource)
            {
            case ScriptSearch.SingleScript:
                _currentSearchDestinations = Convert.ToInt32(EditorGUILayout.EnumMaskField("Search these: ", (AssetSearch)_currentSearchDestinations));
                _targetScript = (MonoScript)EditorGUILayout.ObjectField(_targetScript, typeof(MonoScript), false);
                if (_targetScript != null)
                {
                    if (_componentName != _targetScript.name)
                    {
                        _lastExecutedSearch = ScriptSearch.None;
                    }
                    _componentName = _targetScript.name;
                    if (!_targetScript.GetClass().IsSubclassOf(typeof(MonoBehaviour)))
                    {
                        GUILayout.Label(_componentName + " is not a subclass of MonoBehaviour. Cannot search Prefabs, AddComponent, or Scene Objects.");
                        if (_currentSearchDestinations != 0 && _currentSearchDestinations != (int)AssetSearch.ScriptReference)
                        {
                            if (EditorUtility.DisplayDialog("Invalid Selection", _componentName + " is not a subclass of MonoBehaviour.\nWould you like to search script references?", "Yes", "I'll Search Nothing"))
                            {
                                _currentSearchDestinations = (int)AssetSearch.ScriptReference;
                            }
                            else
                            {
                                _currentSearchDestinations = 0;
                            }
                        }
                    }
                    if (_currentSearchDestinations != 0 && GUILayout.Button("Check script usage"))
                    {
                        AssetDatabase.SaveAssets();
                        var comp = CreateComponentNamesFromAsset(_projectPath, AssetDatabase.GetAssetPath(_targetScript));
                        SearchForDependencies(new List <ComponentNames>()
                        {
                            comp
                        });
                        _lastExecutedSearch = ScriptSearch.SingleScript;
                    }
                }
                break;

            case ScriptSearch.ScriptsInFolder:
                _currentSearchDestinations = Convert.ToInt32(EditorGUILayout.EnumMaskField("Search these: ", (AssetSearch)_currentSearchDestinations));
                if (string.IsNullOrEmpty(_folderPath))
                {
                    _folderPath = Application.dataPath;
                }
                _folderPathIsValid = _folderPath.Contains(Application.dataPath);
                if (ShouldSearchAsset(AssetSearch.ScriptReference) || ShouldSearchAsset(AssetSearch.AddComponent))
                {
                    _excludeReferencesFromOtherScriptsInFolder = GUILayout.Toggle(_excludeReferencesFromOtherScriptsInFolder, "Exclude references from other scripts in folder");
                }
                if (GUILayout.Button("Set Folder Path"))
                {
                    _folderPath = EditorUtility.OpenFolderPanel("Components folder", _folderPath, "");
                }
                if (_folderPathIsValid)
                {
                    GUILayout.Label("Folder path: " + _folderPath);
                    if (_currentSearchDestinations != 0 && GUILayout.Button("Check references to all scripts in folder"))
                    {
                        AssetDatabase.SaveAssets();
                        SearchForDependenciesOfFolderAssets(_folderPath);
                        _lastExecutedSearch = ScriptSearch.ScriptsInFolder;
                    }
                }
                else
                {
                    GUILayout.Label("Must select a folder path inside this project.");
                }
                break;

            case ScriptSearch.AllScripts:
                _currentSearchDestinations = Convert.ToInt32(EditorGUILayout.EnumMaskField("Search these: ", (AssetSearch)_currentSearchDestinations));
                if (_currentSearchDestinations != 0 && GUILayout.Button("Find where all scripts are used"))
                {
                    AssetDatabase.SaveAssets();
                    SearchForUsageOfAllScripts();
                    _lastExecutedSearch = ScriptSearch.AllScripts;
                }
                break;

            case ScriptSearch.UnusedScripts:
                if (GUILayout.Button("Find unused scripts"))
                {
                    AssetDatabase.SaveAssets();
                    SearchForUnusedComponents();
                    _lastExecutedSearch = ScriptSearch.UnusedScripts;
                }
                break;

            case ScriptSearch.MissingComponents:
                if (GUILayout.Button("Search For Missing Components!"))
                {
                    AssetDatabase.SaveAssets();
                    SearchForMissingComponents();
                    _lastExecutedSearch = ScriptSearch.MissingComponents;
                }
                break;

            case ScriptSearch.PrefabReferences:
                _prefabToSearchFor = EditorGUILayout.ObjectField("Prefab to search for", _prefabToSearchFor, typeof(GameObject), false) as GameObject;
                if (_prefabToSearchFor != null && GUILayout.Button("Search for references to prefab"))
                {
                    AssetDatabase.SaveAssets();
                    SearchForReferencesToPrefab();
                    _lastExecutedSearch = ScriptSearch.PrefabReferences;
                }
                break;
            }
        }