@@ -91,39 +91,39 @@ internal static List<object> UnityObjectSearch(string input, string customTypeIn
91
91
if ( ! string . IsNullOrEmpty ( nameFilter ) && ! obj . name . ContainsIgnoreCase ( nameFilter ) )
92
92
continue ;
93
93
94
+ GameObject go = null ;
94
95
var type = obj . GetActualType ( ) ;
95
- if ( type == typeof ( GameObject ) || typeof ( Component ) . IsAssignableFrom ( type ) )
96
+
97
+ if ( type == typeof ( GameObject ) )
98
+ go = obj . TryCast < GameObject > ( ) ;
99
+ else if ( typeof ( Component ) . IsAssignableFrom ( type ) )
100
+ go = obj . TryCast < Component > ( ) ? . gameObject ;
101
+
102
+ if ( go )
96
103
{
97
- GameObject go = type == typeof ( GameObject )
98
- ? obj . TryCast < GameObject > ( )
99
- : obj . TryCast < Component > ( ) ? . gameObject ;
104
+ // hide unityexplorer objects
105
+ if ( go . transform . root . name == "ExplorerCanvas" )
106
+ continue ;
100
107
101
- if ( go )
108
+ if ( shouldFilterGOs )
102
109
{
103
- // hide unityexplorer objects
104
- if ( go . transform . root . name == "ExplorerCanvas" )
105
- continue ;
110
+ // scene check
111
+ if ( sceneFilter != SceneFilter . Any )
112
+ {
113
+ if ( ! Filter ( go . scene , sceneFilter ) )
114
+ continue ;
115
+ }
106
116
107
- if ( shouldFilterGOs )
117
+ if ( childFilter != ChildFilter . Any )
108
118
{
109
- // scene check
110
- if ( sceneFilter != SceneFilter . Any )
111
- {
112
- if ( ! Filter ( go . scene , sceneFilter ) )
113
- continue ;
114
- }
115
-
116
- if ( childFilter != ChildFilter . Any )
117
- {
118
- if ( ! go )
119
- continue ;
120
-
121
- // root object check (no parent)
122
- if ( childFilter == ChildFilter . HasParent && ! go . transform . parent )
123
- continue ;
124
- else if ( childFilter == ChildFilter . RootObject && go . transform . parent )
125
- continue ;
126
- }
119
+ if ( ! go )
120
+ continue ;
121
+
122
+ // root object check (no parent)
123
+ if ( childFilter == ChildFilter . HasParent && ! go . transform . parent )
124
+ continue ;
125
+ else if ( childFilter == ChildFilter . RootObject && go . transform . parent )
126
+ continue ;
127
127
}
128
128
}
129
129
}
0 commit comments