Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 9e7bb1a

Browse files
committed
Cleanup
1 parent 36f23b7 commit 9e7bb1a

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/UI/ObjectExplorer/SearchProvider.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -91,39 +91,39 @@ internal static List<object> UnityObjectSearch(string input, string customTypeIn
9191
if (!string.IsNullOrEmpty(nameFilter) && !obj.name.ContainsIgnoreCase(nameFilter))
9292
continue;
9393

94+
GameObject go = null;
9495
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)
96103
{
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;
100107

101-
if (go)
108+
if (shouldFilterGOs)
102109
{
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+
}
106116

107-
if (shouldFilterGOs)
117+
if (childFilter != ChildFilter.Any)
108118
{
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;
127127
}
128128
}
129129
}

0 commit comments

Comments
 (0)