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

Commit a72877b

Browse files
committed
Make AllTypes protected, force using GetTypeByName
1 parent 16335c1 commit a72877b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Core/Reflection/ReflectionUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected virtual void Initialize()
4242
public static Action<Type> OnTypeLoaded;
4343

4444
/// <summary>Key: Type.FullName</summary>
45-
public static readonly SortedDictionary<string, Type> AllTypes = new SortedDictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
45+
protected static readonly SortedDictionary<string, Type> AllTypes = new SortedDictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
4646

4747
public static readonly List<string> AllNamespaces = new List<string>();
4848
private static readonly HashSet<string> uniqueNamespaces = new HashSet<string>();

src/UI/ObjectExplorer/ObjectSearch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void Update()
7676
lastCheckedTypeInput = desiredTypeInput;
7777

7878
//var type = ReflectionUtility.GetTypeByName(desiredTypeInput);
79-
if (ReflectionUtility.AllTypes.TryGetValue(desiredTypeInput, out var cachedType))
79+
if (ReflectionUtility.GetTypeByName(desiredTypeInput) is Type cachedType)
8080
{
8181
var type = cachedType;
8282
lastTypeCanHaveGO = typeof(Component).IsAssignableFrom(type) || type == typeof(GameObject);

src/UI/Widgets/AutoComplete/TypeCompleter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private void GetSuggestions(string value)
8787
}
8888

8989
// Check for exact match first
90-
if (ReflectionUtility.AllTypes.TryGetValue(value, out Type t) && allowedTypes.Contains(t))
90+
if (ReflectionUtility.GetTypeByName(value) is Type t && allowedTypes.Contains(t))
9191
AddSuggestion(t);
9292

9393
foreach (var entry in allowedTypes)

0 commit comments

Comments
 (0)