Skip to content

Commit

Permalink
如果在puerts所在的程序集找不到AutoStaticCodeRegister,就在所有程序集中找。
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Sep 5, 2020
1 parent 5ac08d8 commit 3f0be4e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion unity/Assets/Puerts/Src/JsEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,16 @@ public JsEnv(ILoader loader, int debugPort = -1)
PuertsDLL.SetGlobalFunction(isolate, "__tgjsGetNestedTypes", StaticCallbacks.JsEnvCallbackWrap, AddCallback(GetNestedTypes));
PuertsDLL.SetGlobalFunction(isolate, "__tgjsGetLoader", StaticCallbacks.JsEnvCallbackWrap, AddCallback(GetLoader));

var autoRegister = Type.GetType("PuertsStaticWrap.AutoStaticCodeRegister", false);
const string AutoStaticCodeRegisterClassName = "PuertsStaticWrap.AutoStaticCodeRegister";
var autoRegister = Type.GetType(AutoStaticCodeRegisterClassName, false);
if (autoRegister == null)
{
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
autoRegister = assembly.GetType(AutoStaticCodeRegisterClassName, false);
if (autoRegister != null) break;
}
}
if (autoRegister != null)
{
var methodInfoOfRegister = autoRegister.GetMethod("Register");
Expand Down

0 comments on commit 3f0be4e

Please sign in to comment.