diff --git a/Editor/3rds/UnityHook/LDasm.cs b/Editor/3rds/UnityHook/LDasm.cs index d766e66..d87ab91 100644 --- a/Editor/3rds/UnityHook/LDasm.cs +++ b/Editor/3rds/UnityHook/LDasm.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.InteropServices; namespace DotNetDetour { @@ -641,15 +642,8 @@ namespace DotNetDetour if(s_isArm.HasValue) return s_isArm.Value; - string processorType = UnityEngine.SystemInfo.processorType; - - /* - * appple M 系列 - * SystemInfo.processorType 返回值为: Apple M1 Max, Apple M2 等 - * SystemInfo.operatingSystem 返回值为: Mac OS X xx.x.x - * - */ - s_isArm = processorType.Contains("ARM") || processorType.Contains("Apple M"); + var arch = RuntimeInformation.ProcessArchitecture; + s_isArm = arch == Architecture.Arm || arch == Architecture.Arm64; return s_isArm.Value; } diff --git a/Editor/3rds/UnityHook/MethodHook.cs b/Editor/3rds/UnityHook/MethodHook.cs index f128c85..2c7c862 100644 --- a/Editor/3rds/UnityHook/MethodHook.cs +++ b/Editor/3rds/UnityHook/MethodHook.cs @@ -363,8 +363,14 @@ namespace MonoHook { if (s_fi_GUISkin_current.GetValue(null) != null) { - DoInstall(); - EditorApplication.update -= OnEditorUpdate; + try + { + DoInstall(); + } + finally + { + EditorApplication.update -= OnEditorUpdate; + } } } #endif