This commit is contained in:
Sinai 2021-05-26 17:42:14 +10:00
parent 36f23b7cdc
commit 9e7bb1a625

View File

@ -91,12 +91,13 @@ namespace UnityExplorer.UI.ObjectExplorer
if (!string.IsNullOrEmpty(nameFilter) && !obj.name.ContainsIgnoreCase(nameFilter)) if (!string.IsNullOrEmpty(nameFilter) && !obj.name.ContainsIgnoreCase(nameFilter))
continue; continue;
GameObject go = null;
var type = obj.GetActualType(); var type = obj.GetActualType();
if (type == typeof(GameObject) || typeof(Component).IsAssignableFrom(type))
{ if (type == typeof(GameObject))
GameObject go = type == typeof(GameObject) go = obj.TryCast<GameObject>();
? obj.TryCast<GameObject>() else if (typeof(Component).IsAssignableFrom(type))
: obj.TryCast<Component>()?.gameObject; go = obj.TryCast<Component>()?.gameObject;
if (go) if (go)
{ {
@ -126,7 +127,6 @@ namespace UnityExplorer.UI.ObjectExplorer
} }
} }
} }
}
results.Add(obj); results.Add(obj);
} }