From 889e6c58d57710abe503ba80dc9668500f5a1fd8 Mon Sep 17 00:00:00 2001 From: Anders Ejlersen Date: Sat, 7 Jun 2025 11:26:44 +0200 Subject: [PATCH] 1.11.1: EditorTypeUtility now uses TypeCache, instead of looking through all assemblies --- Editor/Utilities/EditorTypeUtility.cs | 15 ++++++++++++++- package.json | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Editor/Utilities/EditorTypeUtility.cs b/Editor/Utilities/EditorTypeUtility.cs index a9094fd..46078fb 100644 --- a/Editor/Utilities/EditorTypeUtility.cs +++ b/Editor/Utilities/EditorTypeUtility.cs @@ -163,8 +163,20 @@ namespace Module.Inspector.Editor private static void InternalFetch(Type assignableFrom) { - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); var listTypes = new List(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++) { @@ -179,6 +191,7 @@ namespace Module.Inspector.Editor listTypes.Add(type); } } +#endif listTypes.Sort((t0, t1) => string.Compare(t0.Name, t1.Name, StringComparison.Ordinal)); var fullnames = new string[listTypes.Count]; diff --git a/package.json b/package.json index e123fcb..0287006 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.inspector", - "version": "1.11.0", + "version": "1.11.1", "displayName": "Module.Inspector", "description": "Custom inspector with various useful property drawers", "unity": "2019.2",