From 52f07bc8b3498a6963b04bf35ae948687f834628 Mon Sep 17 00:00:00 2001 From: walon Date: Mon, 12 Oct 2026 12:51:57 +0800 Subject: [PATCH] fix: fix compile error of PatchScriptingAssembliesJsonHook.cs on WebGL or WeixinMiniGame --- .../Hooks/PatchScriptingAssembliesJsonHook.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Editor/BuildProcessors/Hooks/PatchScriptingAssembliesJsonHook.cs b/Editor/BuildProcessors/Hooks/PatchScriptingAssembliesJsonHook.cs index 2576dfb..55f8571 100644 --- a/Editor/BuildProcessors/Hooks/PatchScriptingAssembliesJsonHook.cs +++ b/Editor/BuildProcessors/Hooks/PatchScriptingAssembliesJsonHook.cs @@ -18,9 +18,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +using MonoHook; +using System; +using System.IO; +using System.Reflection; +using System.Runtime.CompilerServices; +using UnityEditor; +using UnityEngine; + namespace HybridCLR.BuildProcessors.Hooks { -#if UNITY_2021_1_OR_NEWER && (UNITY_WEBGL || UNITY_WEIXINMINIGAME) [InitializeOnLoad] public class PatchScriptingAssembliesJsonHook { @@ -36,8 +43,10 @@ namespace HybridCLR.BuildProcessors.Hooks MethodInfo miReplacement = new Func(BuildMainWindowTitle).Method; MethodInfo miProxy = new Func(BuildMainWindowTitleProxy).Method; +#if UNITY_2021_1_OR_NEWER && (UNITY_WEBGL || UNITY_WEIXINMINIGAME) _hook = new MethodHook(miTarget, miReplacement, miProxy); _hook.Install(); +#endif } } @@ -78,5 +87,4 @@ namespace HybridCLR.BuildProcessors.Hooks return string.Empty; } } -#endif }