This commit is contained in:
Mikhail 2024-10-01 19:05:51 +08:00
parent 809f1dbe4e
commit e2fca85636

View File

@ -102,6 +102,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
#if UNITY_EDITOR #if UNITY_EDITOR
namespace DCFApixels.DragonECS.Unity.Editors namespace DCFApixels.DragonECS.Unity.Editors
{ {
using System.Reflection;
using UnityEditor; using UnityEditor;
[InitializeOnLoad] [InitializeOnLoad]
@ -114,10 +115,15 @@ namespace DCFApixels.DragonECS.Unity.Editors
List<Type> serializableTypes = new List<Type>(); List<Type> serializableTypes = new List<Type>();
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) 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<SerializableAttribute>() != null);
var targetTypes = assembly.GetTypes().Where(type => var targetTypes = assembly.GetTypes().Where(type =>
(type.IsGenericType || type.IsAbstract || type.IsInterface) == false && (type.IsGenericType || type.IsAbstract || type.IsInterface) == false &&
type.IsSubclassOf(typeof(UnityObject)) == false && type.IsSubclassOf(typeof(UnityObject)) == false &&
/*type.GetCustomAttribute<SerializableAttribute>() != null*/ true); type.GetConstructor(Type.EmptyTypes) != null);
serializableTypes.AddRange(targetTypes); serializableTypes.AddRange(targetTypes);
} }