public PrefGUI(string customLabel = null, string customValueName = null)
 {
     type        = typeof(T);
     label       = customLabel != null ? customLabel : type.Name;
     valueName   = customValueName != null ? customValueName : label;
     PN_collapse = script.GetType().Name + " " + type.Name + " Collapsed";
     collapse    = new AnimBool(window.Repaint)
     {
         speed = 3.5f, target = EditorLocalPrefs.GetBool(PN_collapse)
     };
     changes         = new List <Changes>();
     foundItemsCount = 0;
     nothingFound    = false;
     showItem        = new bool[0];
 }
            public Prefs <T> DoLayout(Prefs <T> prefs)
            {
                string filter = searchFilter.ToLower();

                nothingFound = false;
                if (!searching)
                {
                    foundItemsCount = prefs.Count;
                }
                else
                {
                    showItem        = new bool[prefs.dictionary.Count];
                    foundItemsCount = 0;
                    int i = 0;
                    foreach (var value in prefs.dictionary)
                    {
                        if (value.Key.ToLower().Contains(filter))
                        {
                            showItem[i] = true;
                            foundItemsCount++;
                        }
                        i++;
                    }
                    nothingFound = foundItemsCount == 0;
                }
                if (window == null || script == null || nothingFound)
                {
                    return(prefs);
                }
                shownTypesCount++;
                changes.Clear();
                EditorGUILayout.BeginVertical(regionBg, GUILayout.MaxHeight(18));
                EditorGUILayout.BeginHorizontal();

                EditorGUI.BeginChangeCheck();
                collapse.target = GUILayout.Toggle(searching ? true : EditorLocalPrefs.GetBool(PN_collapse),
                                                   label, foldout, GUILayout.ExpandWidth(true));
                if (EditorGUI.EndChangeCheck())
                {
                    EditorLocalPrefs.SetBool(PN_collapse, collapse.target);
                }

                GUILayout.FlexibleSpace();
                GUILayout.Button("[" + foundItemsCount + "]", EditorStyles.centeredGreyMiniLabel);

                if (GUILayout.Button(new GUIContent("", !searching ? "Clear All" : "Remove Found Items"), "WinBtnCloseMac"))
                {
                    if (!searching)
                    {
                        prefs.ClearAll();
                    }
                    else
                    {
                        int i = 0;
                        foreach (var value in prefs.dictionary)
                        {
                            if (!showItem[i])
                            {
                                i++;
                                continue;
                            }
                            else
                            {
                                changes.Add(new Changes(value.Key, "", default, false, false, true, 0));