Skip to content

Commit efa494d

Browse files
committed
Added version based define for availability of constant in internal module code. Added conditional compilation of how constant is defined.
1 parent f52ba87 commit efa494d

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Packages/com.unity.inputsystem/InputSystem/Events/InputEvent.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,20 @@ public struct InputEvent
6565
/// </summary>
6666
public const int InvalidEventId = 0;
6767

68+
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT
69+
/// <summary>
70+
/// Defines the packing alignment of native input events in event buffers.
71+
/// </summary>
72+
/// <remarks>
73+
/// This is dictated by the native module implementation which populates the event buffers.
74+
/// </remarks>
75+
internal const int kAlignment = NativeInputEvent.alignment;
76+
#else
77+
/// <summary>
78+
/// Defines the packing alignment of native input events in event buffers.
79+
/// </summary>
6880
internal const int kAlignment = 4;
81+
#endif
6982

7083
[FieldOffset(0)]
7184
private NativeInputEvent m_Event;

Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@
111111
"name": "com.unity.modules.unityanalytics",
112112
"expression": "1",
113113
"define": "UNITY_INPUT_SYSTEM_ENABLE_ANALYTICS"
114+
},
115+
{
116+
"name": "Unity",
117+
"expression": "6000.2.0a11",
118+
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_DEFINES_EVENT_PACKING_ALIGNMENT"
114119
}
115120
],
116121
"noEngineReferences": false

0 commit comments

Comments
 (0)