Update UnityEditorUtility.cs

This commit is contained in:
Mikhail 2026-04-17 13:35:30 +08:00
parent f8b414d926
commit 46a921bbce

View File

@ -120,10 +120,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{ {
//var targetTypes = assembly.GetTypes().Where(type => if (AssemblyFilter.IsExcludedAssembly(assembly)) { continue; }
// (type.IsGenericType || type.IsAbstract || type.IsInterface) == false &&
// type.IsSubclassOf(typeof(UnityObject)) == false &&
// type.GetCustomAttribute<SerializableAttribute>() != null);
foreach (var type in assembly.GetTypes()) foreach (var type in assembly.GetTypes())
{ {
@ -589,5 +586,51 @@ namespace DCFApixels.DragonECS.Unity.Editors
public void OnWorldResize(int newSize) { } public void OnWorldResize(int newSize) { }
} }
} }
public static class AssemblyFilter
{
private static readonly HashSet<string> ExcludedPrefixes = new HashSet<string>
{
"Unity.",
"UnityEngine.",
"UnityEditor.",
"System.",
"mscorlib",
"netstandard",
"Mono.",
"Microsoft.",
"Mono.Security"
};
private static readonly HashSet<string> ExactedExcludedNames = new HashSet<string>
{
"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 #endif