ソースを参照

ComponentViewEditor扫描所有程序集,这样可以在其它包中扩展

tanghai 1 年間 前
コミット
cfdade0622

+ 0 - 1
Unity/Packages/com.et.core/Scripts/Core/Unity.Core.asmdef

@@ -2,7 +2,6 @@
     "name": "Unity.Core",
     "rootNamespace": "ET",
     "references": [
-        "Unity.Mathematics",
         "MemoryPack"
     ],
     "includePlatforms": [],

+ 10 - 7
Unity/Packages/com.et.core/Scripts/Editor/ComponentViewEditor/ComponentViewEditor.cs

@@ -25,16 +25,19 @@ namespace ET
 
         static ComponentViewHelper()
         {
-            Assembly assembly = typeof (ComponentViewHelper).Assembly;
-            foreach (Type type in assembly.GetTypes())
+            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
+            foreach (Assembly assembly in assemblies)
             {
-                if (!type.IsDefined(typeof (TypeDrawerAttribute)))
+                foreach (Type type in assembly.GetTypes())
                 {
-                    continue;
-                }
+                    if (!type.IsDefined(typeof (TypeDrawerAttribute)))
+                    {
+                        continue;
+                    }
 
-                ITypeDrawer iTypeDrawer = (ITypeDrawer) Activator.CreateInstance(type);
-                typeDrawers.Add(iTypeDrawer);
+                    ITypeDrawer iTypeDrawer = (ITypeDrawer) Activator.CreateInstance(type);
+                    typeDrawers.Add(iTypeDrawer);
+                }
             }
         }
         

+ 2 - 2
Unity/Packages/com.et.core/Scripts/Editor/Unity.Core.Editor.asmdef

@@ -2,9 +2,9 @@
     "name": "Unity.Core.Editor",
     "rootNamespace": "ET",
     "references": [
-        "Unity.Mathematics",
         "MemoryPack",
-        "Unity.Core"
+        "Unity.Core",
+        "Unity.Mathematics"
     ],
     "includePlatforms": [],
     "excludePlatforms": [],

+ 0 - 1
Unity/Packages/com.et.core/package.json

@@ -14,7 +14,6 @@
   },
   "relatedPackages": {},
   "dependencies": {
-    "com.unity.mathematics": "1.2.6",
     "com.cysharp.memorypack": ""
   }
 }

+ 0 - 1
Unity/Packages/com.et.loader/Scripts/Editor/Unity.Loader.Editor.asmdef

@@ -7,7 +7,6 @@
         "HybridCLR.Runtime",
         "HybridCLR.Editor",
         "YooAsset",
-        "Unity.Mathematics",
         "Unity.Core.Editor"
     ],
     "includePlatforms": [

+ 0 - 1
Unity/Packages/packages-lock.json

@@ -19,7 +19,6 @@
       "depth": 0,
       "source": "embedded",
       "dependencies": {
-        "com.unity.mathematics": "1.2.6",
         "com.cysharp.memorypack": ""
       }
     },