fix: correct conditional compilation macro for Windows standalone targeting

Fixes an issue where 'UNITY_STANDALONE_WIN' is incorrectly defined when
building or targeting Windows standalone from a non-Windows Unity Editor
(e.g., macOS/Linux). This caused the Editor to incorrectly hit the Windows
code path (kernel32.dll / VirtualProtect) instead of the POSIX one, leading
to compilation errors or runtime crashes during the build process.
This commit is contained in:
walon
2026-05-18 22:29:44 +08:00
parent 4feac30cb2
commit f0be76c0ce
+2 -2
View File
@@ -50,7 +50,7 @@ namespace MonoHook
if (ptr == IntPtr.Zero)
return;
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
#if UNITY_EDITOR_WIN || (!UNITY_EDITOR && UNITY_STANDALONE_WIN)
uint oldProtect;
bool ret = VirtualProtect(ptr, (uint)size, Protection.PAGE_EXECUTE_READWRITE, out oldProtect);
UnityEngine.Debug.Assert(ret);
@@ -223,7 +223,7 @@ namespace MonoHook
};
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
#if UNITY_EDITOR_WIN || (!UNITY_EDITOR && UNITY_STANDALONE_WIN)
[Flags]
public enum Protection
{