diff --git a/src/Internal/Editor/UnityEditorUtility.cs b/src/Internal/Editor/UnityEditorUtility.cs index e293f33..9876998 100644 --- a/src/Internal/Editor/UnityEditorUtility.cs +++ b/src/Internal/Editor/UnityEditorUtility.cs @@ -120,10 +120,7 @@ namespace DCFApixels.DragonECS.Unity.Editors foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { - //var targetTypes = assembly.GetTypes().Where(type => - // (type.IsGenericType || type.IsAbstract || type.IsInterface) == false && - // type.IsSubclassOf(typeof(UnityObject)) == false && - // type.GetCustomAttribute() != null); + if (AssemblyFilter.IsExcludedAssembly(assembly)) { continue; } foreach (var type in assembly.GetTypes()) { @@ -589,5 +586,51 @@ namespace DCFApixels.DragonECS.Unity.Editors public void OnWorldResize(int newSize) { } } } + + public static class AssemblyFilter + { + private static readonly HashSet ExcludedPrefixes = new HashSet + { + "Unity.", + "UnityEngine.", + "UnityEditor.", + "System.", + "mscorlib", + "netstandard", + "Mono.", + "Microsoft.", + "Mono.Security" + }; + + private static readonly HashSet ExactedExcludedNames = new HashSet + { + "System", + "System.Core", + "System.Xml", + "System.Runtime", + "System.Collections", + "System.Linq", + "System.Text.RegularExpressions", + "UnityEngine", + "UnityEditor", + }; + + public static bool IsExcludedAssembly(Assembly assembly) + { + string assemblyName = assembly.GetName().Name; + if (ExactedExcludedNames.Contains(assemblyName)) + { + return true; + } + foreach (var prefix in ExcludedPrefixes) + { + if (assemblyName.StartsWith(prefix, StringComparison.Ordinal)) + { + return true; + } + } + return false; + } + } } #endif \ No newline at end of file