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

Commit d4fbc89

Browse files
committed
Use ReflectionUtility.AllTypes when doing class search to include static classes
1 parent 9e49f09 commit d4fbc89

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/ObjectExplorer/ObjectSearch.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ private void OnContextDropdownChanged(int value)
9999

100100
nameInputRow.SetActive(context == SearchContext.UnityObject);
101101

102-
typeAutocompleter.BaseType = context == SearchContext.UnityObject ? typeof(UnityEngine.Object) : typeof(object);
102+
if (context == SearchContext.Class)
103+
typeAutocompleter.AllTypes = true;
104+
else
105+
{
106+
typeAutocompleter.BaseType = context == SearchContext.UnityObject ? typeof(UnityEngine.Object) : typeof(object);
107+
typeAutocompleter.AllTypes = false;
108+
}
103109
typeAutocompleter.CacheTypes();
104110
}
105111

src/UI/Widgets/AutoComplete/TypeCompleter.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public bool Enabled
2525

2626
public Type BaseType { get; set; }
2727
public Type[] GenericConstraints { get; set; }
28+
public bool AllTypes { get; set; }
29+
2830
private readonly bool allowAbstract;
2931
private readonly bool allowEnum;
3032

@@ -58,7 +60,14 @@ public TypeCompleter(Type baseType, InputFieldRef inputField, bool allowAbstract
5860

5961
public void CacheTypes()
6062
{
61-
allowedTypes = ReflectionUtility.GetImplementationsOf(BaseType, allowAbstract, allowEnum, false);
63+
if (!AllTypes)
64+
allowedTypes = ReflectionUtility.GetImplementationsOf(BaseType, allowAbstract, allowEnum, false);
65+
else
66+
{
67+
allowedTypes = new();
68+
foreach (var entry in ReflectionUtility.AllTypes)
69+
allowedTypes.Add(entry.Value as Type);
70+
}
6271
}
6372

6473
public void OnSuggestionClicked(Suggestion suggestion)

0 commit comments

Comments
 (0)