1.11.1: EditorTypeUtility now uses TypeCache, instead of looking through all assemblies
This commit is contained in:
parent
3a825efa2a
commit
889e6c58d5
|
|
@ -163,9 +163,21 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
private static void InternalFetch(Type assignableFrom)
|
private static void InternalFetch(Type assignableFrom)
|
||||||
{
|
{
|
||||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
||||||
var listTypes = new List<Type>(32);
|
var listTypes = new List<Type>(32);
|
||||||
|
|
||||||
|
#if UNITY_2021_3 || UNITY_2022_2 || UNITY_6000_0_OR_NEWER
|
||||||
|
var types = TypeCache.GetTypesDerivedFrom(assignableFrom);
|
||||||
|
|
||||||
|
for (var i = 0; i < types.Count; i++)
|
||||||
|
{
|
||||||
|
Type type = types[i];
|
||||||
|
|
||||||
|
if (!type.IsAbstract)
|
||||||
|
listTypes.Add(type);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
|
||||||
for (var i = 0; i < assemblies.Length; i++)
|
for (var i = 0; i < assemblies.Length; i++)
|
||||||
{
|
{
|
||||||
Assembly assembly = assemblies[i];
|
Assembly assembly = assemblies[i];
|
||||||
|
|
@ -179,6 +191,7 @@ namespace Module.Inspector.Editor
|
||||||
listTypes.Add(type);
|
listTypes.Add(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
listTypes.Sort((t0, t1) => string.Compare(t0.Name, t1.Name, StringComparison.Ordinal));
|
listTypes.Sort((t0, t1) => string.Compare(t0.Name, t1.Name, StringComparison.Ordinal));
|
||||||
var fullnames = new string[listTypes.Count];
|
var fullnames = new string[listTypes.Count];
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.module.inspector",
|
"name": "com.module.inspector",
|
||||||
"version": "1.11.0",
|
"version": "1.11.1",
|
||||||
"displayName": "Module.Inspector",
|
"displayName": "Module.Inspector",
|
||||||
"description": "Custom inspector with various useful property drawers",
|
"description": "Custom inspector with various useful property drawers",
|
||||||
"unity": "2019.2",
|
"unity": "2019.2",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue