From efa494d4aa9fb397438f654e4557f1026c5accaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akan=20Sidenvall?= Date: Tue, 6 May 2025 09:59:12 +0200 Subject: [PATCH 1/2] Added version based define for availability of constant in internal module code. Added conditional compilation of how constant is defined. --- .../InputSystem/Events/InputEvent.cs | 13 +++++++++++++ .../InputSystem/Unity.InputSystem.asmdef | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/Packages/com.unity.inputsystem/InputSystem/Events/InputEvent.cs b/Packages/com.unity.inputsystem/InputSystem/Events/InputEvent.cs index 7dfe7f045d..09787c9eeb 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Events/InputEvent.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Events/InputEvent.cs @@ -65,7 +65,20 @@ public struct InputEvent /// public const int InvalidEventId = 0; + #if UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT + /// + /// Defines the packing alignment of native input events in event buffers. + /// + /// + /// This is dictated by the native module implementation which populates the event buffers. + /// + internal const int kAlignment = NativeInputEvent.alignment; + #else + /// + /// Defines the packing alignment of native input events in event buffers. + /// internal const int kAlignment = 4; + #endif [FieldOffset(0)] private NativeInputEvent m_Event; diff --git a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef index cbf773a654..eb4e96ebc9 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef +++ b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef @@ -111,6 +111,11 @@ "name": "com.unity.modules.unityanalytics", "expression": "1", "define": "UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS" + }, + { + "name": "Unity", + "expression": "6000.2.0a11", + "define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT" } ], "noEngineReferences": false From f3f103bbaad45b0a70e3958c84cd12189aba3bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akan=20Sidenvall?= Date: Tue, 6 May 2025 15:34:37 +0200 Subject: [PATCH 2/2] Need to bump version in asmdef to not cause problems with trunk CI runs --- .../com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef index eb4e96ebc9..0c1ec3af68 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef +++ b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef @@ -114,7 +114,7 @@ }, { "name": "Unity", - "expression": "6000.2.0a11", + "expression": "6000.3.0", "define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT" } ],