Remove redundant GameObject search context

This commit is contained in:
Sinai 2021-05-11 02:39:01 +10:00
parent 4019af5936
commit 8a15c11289
2 changed files with 8 additions and 8 deletions

View File

@ -101,7 +101,7 @@ namespace UnityExplorer.UI.ObjectExplorer
{
m_context = (SearchContext)value;
bool shouldShowGoFilters = m_context == SearchContext.GameObject || m_context == SearchContext.UnityObject;
bool shouldShowGoFilters = m_context == SearchContext.UnityObject;
sceneFilterRow.SetActive(shouldShowGoFilters);
childFilterRow.SetActive(shouldShowGoFilters);
@ -177,7 +177,7 @@ namespace UnityExplorer.UI.ObjectExplorer
unityObjectClassRow = UIFactory.CreateHorizontalGroup(uiRoot, "UnityClassRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(unityObjectClassRow, minHeight: 25, flexibleHeight: 0);
var unityClassLbl = UIFactory.CreateLabel(unityObjectClassRow, "UnityClassLabel", "Custom Type:", TextAnchor.MiddleLeft);
var unityClassLbl = UIFactory.CreateLabel(unityObjectClassRow, "UnityClassLabel", "Class filter:", TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(unityClassLbl.gameObject, minWidth: 110, flexibleWidth: 0);
var classInputField = UIFactory.CreateInputField(unityObjectClassRow, "ClassInput", "...");

View File

@ -13,7 +13,7 @@ namespace UnityExplorer.UI.ObjectExplorer
public enum SearchContext
{
UnityObject,
GameObject,
// GameObject,
Singleton,
StaticClass
}
@ -61,9 +61,9 @@ namespace UnityExplorer.UI.ObjectExplorer
Type searchType;
switch (context)
{
case SearchContext.GameObject:
searchType = typeof(GameObject);
break;
//case SearchContext.GameObject:
// searchType = typeof(GameObject);
// break;
case SearchContext.UnityObject:
default:
@ -100,7 +100,7 @@ namespace UnityExplorer.UI.ObjectExplorer
if (!string.IsNullOrEmpty(input))
nameFilter = input;
bool canGetGameObject = context == SearchContext.GameObject || typeof(Component).IsAssignableFrom(searchType);
bool canGetGameObject = searchType == typeof(GameObject) || typeof(Component).IsAssignableFrom(searchType);
foreach (var obj in allObjects)
{
@ -110,7 +110,7 @@ namespace UnityExplorer.UI.ObjectExplorer
if (canGetGameObject)
{
var go = context == SearchContext.GameObject
var go = searchType == typeof(GameObject)
? obj.TryCast<GameObject>()
: obj.TryCast<Component>().gameObject;