Use TypeCache instead of manual type iteration

fix/use-type-cache
This commit is contained in:
theo-rapidfire 2024-03-28 13:39:48 +01:00
parent 301cb4b12c
commit f7c1017567

View File

@ -27,9 +27,8 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
{ {
Type[] interfaceTypes = type.GetInterfaces(); Type[] interfaceTypes = type.GetInterfaces();
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) var types = TypeCache.GetTypesWithAttribute<CustomPropertyDrawer>();
{ foreach (Type drawerType in types)
foreach (Type drawerType in assembly.GetTypes())
{ {
var customPropertyDrawerAttributes = drawerType.GetCustomAttributes(typeof(CustomPropertyDrawer), true); var customPropertyDrawerAttributes = drawerType.GetCustomAttributes(typeof(CustomPropertyDrawer), true);
foreach (CustomPropertyDrawer customPropertyDrawer in customPropertyDrawerAttributes) foreach (CustomPropertyDrawer customPropertyDrawer in customPropertyDrawerAttributes)
@ -75,7 +74,6 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
} }
} }
} }
}
return null; return null;
} }