Make AllTypes protected, force using GetTypeByName

This commit is contained in:
Sinai 2021-06-07 19:26:46 +10:00
parent 16335c1bc4
commit a72877befb
3 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ namespace UnityExplorer
public static Action<Type> OnTypeLoaded;
/// <summary>Key: Type.FullName</summary>
public static readonly SortedDictionary<string, Type> AllTypes = new SortedDictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
protected static readonly SortedDictionary<string, Type> AllTypes = new SortedDictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
public static readonly List<string> AllNamespaces = new List<string>();
private static readonly HashSet<string> uniqueNamespaces = new HashSet<string>();

View File

@ -76,7 +76,7 @@ namespace UnityExplorer.UI.ObjectExplorer
lastCheckedTypeInput = desiredTypeInput;
//var type = ReflectionUtility.GetTypeByName(desiredTypeInput);
if (ReflectionUtility.AllTypes.TryGetValue(desiredTypeInput, out var cachedType))
if (ReflectionUtility.GetTypeByName(desiredTypeInput) is Type cachedType)
{
var type = cachedType;
lastTypeCanHaveGO = typeof(Component).IsAssignableFrom(type) || type == typeof(GameObject);

View File

@ -87,7 +87,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
}
// Check for exact match first
if (ReflectionUtility.AllTypes.TryGetValue(value, out Type t) && allowedTypes.Contains(t))
if (ReflectionUtility.GetTypeByName(value) is Type t && allowedTypes.Contains(t))
AddSuggestion(t);
foreach (var entry in allowedTypes)