diff --git a/unity/Assets/Puerts/Src/JsEnv.cs b/unity/Assets/Puerts/Src/JsEnv.cs index ab75efc397..60b74e5cae 100644 --- a/unity/Assets/Puerts/Src/JsEnv.cs +++ b/unity/Assets/Puerts/Src/JsEnv.cs @@ -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");