@@ -51,6 +51,7 @@ private void Initialize() {
5151 showMethods = EditorPrefs . GetBool ( "inspectorplus_methods" , true ) ;
5252 locked = EditorPrefs . GetBool ( "inspectorplus_lock" , false ) ;
5353 showObsolete = EditorPrefs . GetBool ( "inspectorplus_obsolete" , false ) ;
54+ searchMode = EditorPrefs . GetInt ( "inspectorplus_searchmode" , 0 ) ;
5455 initialized = true ;
5556 }
5657
@@ -64,7 +65,7 @@ private void OnGUI() {
6465 GUILayout . Space ( 8 ) ;
6566 searchText = Helper . ToolbarSearchField ( searchText ?? string . Empty , searchModes , ref searchMode ) ;
6667 if ( GUI . changed )
67- UpdateTitle ( ) ;
68+ UpdateSearchMode ( ) ;
6869 GUILayout . Space ( 8 ) ;
6970 EditorGUI . BeginDisabledGroup ( instanceIds == null || instanceIds . Length == 0 || searchMode != 0 ) ;
7071 if ( GUILayout . Button ( EditorGUIUtility . IconContent ( "TreeEditor.Trash" , "Destroy Selection" ) ,
@@ -109,7 +110,7 @@ private void ShowButton(Rect rect) {
109110
110111 void IHasCustomMenu . AddItemsToMenu ( GenericMenu menu ) {
111112 for ( int i = 0 ; i < searchModes . Length ; i ++ )
112- menu . AddItem ( new GUIContent ( searchModes [ i ] ) , searchMode == i , ChangeSearchMode , i ) ;
113+ menu . AddItem ( new GUIContent ( searchModes [ i ] ) , searchMode == i , UpdateSearchMode , i ) ;
113114 if ( searchMode != 0 ) return ;
114115 menu . AddSeparator ( "" ) ;
115116 menu . AddItem ( new GUIContent ( "Refresh" ) , false , RefreshList ) ;
@@ -159,20 +160,23 @@ private void RefreshList() {
159160 }
160161
161162 private void TriggerLock ( ) {
163+ if ( ! locked && Selection . activeObject == null )
164+ return ;
162165 locked = ! locked ;
163166 if ( ! locked )
164167 OnSelectionChange ( ) ;
165168 EditorPrefs . SetBool ( "inspectorplus_lock" , locked ) ;
166169 }
167170
168- private void ChangeSearchMode ( object mode ) {
171+ private void UpdateSearchMode ( object mode ) {
169172 searchMode = ( int ) mode ;
170- UpdateTitle ( ) ;
173+ UpdateSearchMode ( ) ;
171174 RefreshList ( ) ;
172175 }
173176
174- private void UpdateTitle ( ) {
177+ private void UpdateSearchMode ( ) {
175178 titleContent . text = titles [ searchMode ] ;
179+ EditorPrefs . SetInt ( "inspectorplus_searchmode" , searchMode ) ;
176180 }
177181
178182 private void OnSelectionChange ( ) {
0 commit comments