From c7c00eac9f6dc393935163bf468379817a886c6f Mon Sep 17 00:00:00 2001 From: "mr.zz" Date: Wed, 7 Aug 2024 23:58:47 +0800 Subject: [PATCH] * [fix] installed as a package ,class not found issue --- .../EventInterface/EventInterfaceGenerate.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/UnityProject/Assets/TEngine/Editor/EventInterface/EventInterfaceGenerate.cs b/UnityProject/Assets/TEngine/Editor/EventInterface/EventInterfaceGenerate.cs index 9ff2f2a1..cc08c506 100644 --- a/UnityProject/Assets/TEngine/Editor/EventInterface/EventInterfaceGenerate.cs +++ b/UnityProject/Assets/TEngine/Editor/EventInterface/EventInterfaceGenerate.cs @@ -69,7 +69,23 @@ public static class EventInterfaceGenerate EventInterfaceGenerateTag.HadGenerate = true; // 加载程序集 - Assembly assembly = typeof(GameApp).Assembly; + Assembly assembly = null; + foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) + { + foreach(var type in asm.GetTypes()) + { + if (type.Name == "GameApp") + { + assembly = asm; + break; + } + } + } + if(assembly == null) + { + Debug.LogError("Game App Class Not Found"); + return; + } // 获取程序集中的所有类型 Type[] types = assembly.GetTypes();