From 5cdec456d40e9a26d76a901dd49abebc872a1126 Mon Sep 17 00:00:00 2001 From: leonardo Date: Wed, 3 Jun 2026 12:26:15 +0200 Subject: [PATCH 1/2] FIX: Replace deprecated DEVELOPMENT_BUILD / UNITY_64 directives flagged by Unity 6000.6 PVP-301-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unity 6000.6 enforces a new Package Validator Plugin rule (PVP-301-1) that fails Validate jobs on three deprecated patterns flagged by the UAC0008 / UAC0009 / UAC1001 analyzers. All flagged sites already exist on develop and are pre-existing; nothing in the runtime semantics is intended to change. Replacements: - UAC0009: `#if DEVELOPMENT_BUILD || UNITY_EDITOR` (and the swapped-order variant) becomes `#if UNITY_EDITOR || UNITY_ENABLE_CHECKS`. UNITY_ENABLE_CHECKS is Unity 6's modern equivalent (set in editor, development players, and debug configurations), so it preserves the prior "validate in editor + development players" semantic. - InputSystem.cs (2 sites: 3369, 3509 — the latter switches to `!UNITY_EDITOR && UNITY_ENABLE_CHECKS` to preserve the "auto-enable remoting only in development players, not in editor" semantic of the original `#if DEVELOPMENT_BUILD`). - InputManager.cs (1 site). - InputControlExtensions.cs (17 sites — argument-validation guards on hot-path ControlBuilder methods). - InputControlList.cs (2 sites — `[DebuggerTypeProxy]` attribute and DebugView class guard). - InputRemoting.cs, InputEventBuffer.cs, InputStateBuffers.cs, InputSystemState.cs, PlayerInputManager.cs (1 site each). - EnhancedTouchSupport.cs: `[Conditional("DEVELOPMENT_BUILD")]` becomes `[Conditional("UNITY_ENABLE_CHECKS")]` (the companion `[Conditional("UNITY_EDITOR")]` is unchanged). - UAC0008: `#if UNITY_64` in MemoryHelpers.cs (MemSet, MemCpyMasked) becomes `if (IntPtr.Size == 8)` so the 64-bit-optimised 8-byte block loops are still emitted but gated at runtime instead of compile time. JIT folds the branch on 64-bit targets, so there's no measurable overhead in practice. - UAC1001: Added `[NonSerialized]` on three HID fields whose types (`System.Type`, `int?`) are not Unity-serialisable: `HID.HIDLayoutBuilder.deviceType`, `HID.HIDElementDescriptor.usageMin`, and `usageMax`. These were already being skipped by Unity's serializer, so this is purely making the existing behaviour explicit and silencing the analyzer. Co-Authored-By: Claude Opus 4.7 (1M context) --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + .../Controls/InputControlExtensions.cs | 34 +++++++++---------- .../Runtime/Controls/InputControlList.cs | 4 +-- .../Runtime/Devices/Remote/InputRemoting.cs | 2 +- .../Runtime/Events/InputEventBuffer.cs | 2 +- .../InputSystem/Runtime/InputManager.cs | 4 +-- .../InputSystem/Runtime/InputSystem.cs | 6 ++-- .../InputSystem/Runtime/InputSystemState.cs | 2 +- .../EnhancedTouch/EnhancedTouchSupport.cs | 2 +- .../InputSystem/Runtime/Plugins/HID/HID.cs | 6 ++-- .../Plugins/PlayerInput/PlayerInputManager.cs | 2 +- .../Runtime/State/InputStateBuffers.cs | 2 +- .../Runtime/Utilities/MemoryHelpers.cs | 34 ++++++++++--------- 13 files changed, 52 insertions(+), 49 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index f64be23383..b142f837a0 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed InputSystem.onAnyButtonPress fails to trigger when the device receives a touch [UUM-137930](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-137930). - Fixed an incorrect ArraysHelper.HaveDuplicateReferences implementation that didn't use its arguments right [ISXB-1792] (https://github.com/Unity-Technologies/InputSystem/pull/2376) - Fixed `InputAction.IsPressed`, `WasPressedThisFrame`, and `WasReleasedThisFrame` using a `ButtonControl`'s `pressPoint` when a binding also had an explicit `PressInteraction` with its own `pressPoint`, which could make those APIs disagree with the interaction's press and release behavior. Action-level press APIs now follow the interaction threshold when both are set explicitly. +- Replaced deprecated `DEVELOPMENT_BUILD` and `UNITY_64` preprocessor directives flagged by the `UAC0008` / `UAC0009` analyzers on Unity 6000.6 (Package Validation rule `PVP-301-1`). `#if DEVELOPMENT_BUILD || UNITY_EDITOR` becomes `#if UNITY_EDITOR || UNITY_ENABLE_CHECKS`, `#if UNITY_64` becomes a runtime `IntPtr.Size == 8` check. Also added `[NonSerialized]` on `HID.HIDLayoutBuilder.deviceType` and `HID.HIDElementDescriptor.usageMin` / `usageMax` to silence `UAC1001`. No behavioural change. ### Changed - Action-level `IsPressed`, `WasPressedThisFrame`, and `WasReleasedThisFrame` for bindings to `Vector2Control` / `StickControl` no longer consult a per-control `pressPoint` on the vector (that field was removed). Use a `Press` interaction to set a custom threshold, or rely on `defaultButtonPressPoint`. diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs index 32955d8716..585666a042 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs @@ -1616,7 +1616,7 @@ public struct ControlBuilder [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder At(InputDevice device, int index) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (device == null) throw new ArgumentNullException(nameof(device)); if (index < 0 || index >= device.m_ChildrenForEachControl.Length) @@ -1630,7 +1630,7 @@ public ControlBuilder At(InputDevice device, int index) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithParent(InputControl parent) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (parent == null) throw new ArgumentNullException(nameof(parent)); if (parent == control) @@ -1643,7 +1643,7 @@ public ControlBuilder WithParent(InputControl parent) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithName(string name) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); #endif @@ -1654,7 +1654,7 @@ public ControlBuilder WithName(string name) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithDisplayName(string displayName) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (string.IsNullOrEmpty(displayName)) throw new ArgumentNullException(nameof(displayName)); #endif @@ -1665,7 +1665,7 @@ public ControlBuilder WithDisplayName(string displayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithShortDisplayName(string shortDisplayName) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (string.IsNullOrEmpty(shortDisplayName)) throw new ArgumentNullException(nameof(shortDisplayName)); #endif @@ -1676,7 +1676,7 @@ public ControlBuilder WithShortDisplayName(string shortDisplayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithLayout(InternedString layout) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (layout.IsEmpty()) throw new ArgumentException("Layout name cannot be empty", nameof(layout)); #endif @@ -1687,7 +1687,7 @@ public ControlBuilder WithLayout(InternedString layout) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithUsages(int startIndex, int count) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (startIndex < 0 || startIndex >= control.device.m_UsagesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > control.device.m_UsagesForEachControl.Length) @@ -1701,7 +1701,7 @@ public ControlBuilder WithUsages(int startIndex, int count) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithAliases(int startIndex, int count) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (startIndex < 0 || startIndex >= control.device.m_AliasesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > control.device.m_AliasesForEachControl.Length) @@ -1715,7 +1715,7 @@ public ControlBuilder WithAliases(int startIndex, int count) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithChildren(int startIndex, int count) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (startIndex < 0 || startIndex >= control.device.m_ChildrenForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > control.device.m_ChildrenForEachControl.Length) @@ -1754,7 +1754,7 @@ public ControlBuilder WithProcessor(TProcessor processor) where TValue : struct where TProcessor : InputProcessor { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (processor == null) throw new ArgumentNullException(nameof(processor)); #endif @@ -1808,7 +1808,7 @@ public struct DeviceBuilder [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithName(string name) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); #endif @@ -1819,7 +1819,7 @@ public DeviceBuilder WithName(string name) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithDisplayName(string displayName) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (string.IsNullOrEmpty(displayName)) throw new ArgumentNullException(nameof(displayName)); #endif @@ -1830,7 +1830,7 @@ public DeviceBuilder WithDisplayName(string displayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithShortDisplayName(string shortDisplayName) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (string.IsNullOrEmpty(shortDisplayName)) throw new ArgumentNullException(nameof(shortDisplayName)); #endif @@ -1841,7 +1841,7 @@ public DeviceBuilder WithShortDisplayName(string shortDisplayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithLayout(InternedString layout) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (layout.IsEmpty()) throw new ArgumentException("Layout name cannot be empty", nameof(layout)); #endif @@ -1852,7 +1852,7 @@ public DeviceBuilder WithLayout(InternedString layout) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithChildren(int startIndex, int count) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (startIndex < 0 || startIndex >= device.device.m_ChildrenForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > device.device.m_ChildrenForEachControl.Length) @@ -1880,7 +1880,7 @@ public DeviceBuilder IsNoisy(bool value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithControlUsage(int controlIndex, InternedString usage, InputControl control) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (controlIndex < 0 || controlIndex >= device.m_UsagesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(controlIndex)); if (usage.IsEmpty()) @@ -1896,7 +1896,7 @@ public DeviceBuilder WithControlUsage(int controlIndex, InternedString usage, In [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithControlAlias(int controlIndex, InternedString alias) { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (controlIndex < 0 || controlIndex >= device.m_AliasesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(controlIndex)); if (alias.IsEmpty()) diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs index 92f123ac2e..c94de879af 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs @@ -45,7 +45,7 @@ namespace UnityEngine.InputSystem /// /// Type of to store in the list. [DebuggerDisplay("Count = {Count}")] - #if UNITY_EDITOR || DEVELOPMENT_BUILD + #if UNITY_EDITOR || UNITY_ENABLE_CHECKS [DebuggerTypeProxy(typeof(InputControlListDebugView<>))] #endif public unsafe struct InputControlList : IList, IReadOnlyList, IDisposable @@ -597,7 +597,7 @@ public void Dispose() } } - #if UNITY_EDITOR || DEVELOPMENT_BUILD + #if UNITY_EDITOR || UNITY_ENABLE_CHECKS internal struct InputControlListDebugView where TControl : InputControl { diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs index 2d4ecb5eb9..ec0af96c39 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs @@ -757,7 +757,7 @@ private static TData DeserializeData(byte[] data) return JsonUtility.FromJson(json); } -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS // State we want to take across domain reloads. We can only take some of the // state across. Subscriptions will be lost and have to be manually restored. [Serializable] diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs index 872b4e93bb..47a50819e1 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs @@ -298,7 +298,7 @@ internal void AdvanceToNextEvent(ref InputEvent* currentReadPos, if (numRemainingEvents > 1) { // Don't perform safety check in non-debug builds. - #if UNITY_EDITOR || DEVELOPMENT_BUILD + #if UNITY_EDITOR || UNITY_ENABLE_CHECKS newReadPos = InputEvent.GetNextInMemoryChecked(currentReadPos, ref this); #else newReadPos = InputEvent.GetNextInMemory(currentReadPos); diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs index e7f6cd9ee9..557abffec8 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs @@ -4481,7 +4481,7 @@ private bool FlipBuffersForDeviceIfNecessary(InputDevice device, InputUpdateType // Stuff everything that we want to survive a domain reload into // a m_SerializedState. - #if UNITY_EDITOR || DEVELOPMENT_BUILD + #if UNITY_EDITOR || UNITY_ENABLE_CHECKS [Serializable] internal struct DeviceState { @@ -4795,6 +4795,6 @@ private bool RestoreDeviceFromSavedState(ref DeviceState deviceState, InternedSt return true; } -#endif // UNITY_EDITOR || DEVELOPMENT_BUILD +#endif // UNITY_EDITOR || UNITY_ENABLE_CHECKS } } diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs index 1864b5d421..db87363381 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs @@ -3366,7 +3366,7 @@ public static bool runInBackground internal static InputManager s_Manager; internal static InputRemoting s_Remote; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS private static RemoteInputPlayerConnection s_RemoteConnection; internal static RemoteInputPlayerConnection remoteConnection @@ -3411,7 +3411,7 @@ private static bool ShouldEnableRemoting() } #endif //!UNITY_EDITOR -#endif // DEVELOPMENT_BUILD || UNITY_EDITOR +#endif // UNITY_EDITOR || UNITY_ENABLE_CHECKS // The rest here is internal stuff to manage singletons, survive domain reloads, // and to support the reset ability for tests. @@ -3506,7 +3506,7 @@ internal static void InitializeInPlayer(IInputRuntime runtime = null, bool loadS #endif // Automatically enable remoting in development players. - #if DEVELOPMENT_BUILD + #if !UNITY_EDITOR && UNITY_ENABLE_CHECKS if (ShouldEnableRemoting()) SetUpRemoting(); #endif diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs index b42cd90786..b27a023b87 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs @@ -5,7 +5,7 @@ namespace UnityEngine.InputSystem { -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS /// /// Snapshot of the state used by the input system. /// diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs index 637c614446..588d8b2df7 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs @@ -202,7 +202,7 @@ private static void OnBeforeDomainReload() #endif - [Conditional("DEVELOPMENT_BUILD")] + [Conditional("UNITY_ENABLE_CHECKS")] [Conditional("UNITY_EDITOR")] internal static void CheckEnabled() { diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/HID/HID.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/HID/HID.cs index 9becfbe872..b3bbacb945 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/HID/HID.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/HID/HID.cs @@ -323,7 +323,7 @@ private class HIDLayoutBuilder public string displayName; public HIDDeviceDescriptor hidDescriptor; public string parentLayout; - public Type deviceType; + [NonSerialized] public Type deviceType; public InputControlLayout Build() { @@ -517,8 +517,8 @@ public struct HIDElementDescriptor public HIDElementFlags flags; // Fields only relevant to arrays. - public int? usageMin; - public int? usageMax; + [NonSerialized] public int? usageMin; + [NonSerialized] public int? usageMax; public bool hasNullState => (flags & HIDElementFlags.NullState) == HIDElementFlags.NullState; diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs index 28f9338f61..a912e8525c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs @@ -706,7 +706,7 @@ private bool IsDeviceUsableWithPlayerActions(InputDevice device) private void ValidateInputActionAsset() { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if UNITY_EDITOR || UNITY_ENABLE_CHECKS if (m_PlayerPrefab == null || m_PlayerPrefab.GetComponentInChildren() == null) return; diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs index eae5349bbe..ec9c9632e5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs @@ -330,7 +330,7 @@ private static void MigrateDoubleBuffer(DoubleBuffers newBuffer, InputDevice[] d // NOTE: This also means that device indices of if (device.m_StateBlock.byteOffset == InputStateBlock.InvalidOffset) { - #if DEVELOPMENT_BUILD || UNITY_EDITOR + #if UNITY_EDITOR || UNITY_ENABLE_CHECKS for (var n = i + 1; n < deviceCount; ++n) Debug.Assert(devices[n].m_StateBlock.byteOffset == InputStateBlock.InvalidOffset, "New devices must be appended to the array; found an old device coming in the array after a newly added device"); diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Utilities/MemoryHelpers.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Utilities/MemoryHelpers.cs index 21ad623ef2..a51ff665ac 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Utilities/MemoryHelpers.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Utilities/MemoryHelpers.cs @@ -241,16 +241,17 @@ public static void MemSet(void* destination, int numBytes, byte value) unchecked { - // 64bit blocks. - #if UNITY_64 - while (numBytes >= 8) + // 64bit blocks (only on 64-bit runtimes; JIT folds the branch). + if (IntPtr.Size == 8) { - *(ulong*)&to[pos] = ((ulong)value << 56) | ((ulong)value << 48) | ((ulong)value << 40) | ((ulong)value << 32) - | ((ulong)value << 24) | ((ulong)value << 16) | ((ulong)value << 8) | value; - numBytes -= 8; - pos += 8; + while (numBytes >= 8) + { + *(ulong*)&to[pos] = ((ulong)value << 56) | ((ulong)value << 48) | ((ulong)value << 40) | ((ulong)value << 32) + | ((ulong)value << 24) | ((ulong)value << 16) | ((ulong)value << 8) | value; + numBytes -= 8; + pos += 8; + } } - #endif // 32bit blocks. while (numBytes >= 4) @@ -287,16 +288,17 @@ public static void MemCpyMasked(void* destination, void* source, int numBytes, v unchecked { - // Copy 64bit blocks. - #if UNITY_64 - while (numBytes >= 8) + // Copy 64bit blocks (only on 64-bit runtimes; JIT folds the branch). + if (IntPtr.Size == 8) { - *(ulong*)(to + pos) &= ~*(ulong*)(bits + pos); // Preserve unmasked bits. - *(ulong*)(to + pos) |= *(ulong*)(from + pos) & *(ulong*)(bits + pos); // Copy masked bits. - numBytes -= 8; - pos += 8; + while (numBytes >= 8) + { + *(ulong*)(to + pos) &= ~*(ulong*)(bits + pos); // Preserve unmasked bits. + *(ulong*)(to + pos) |= *(ulong*)(from + pos) & *(ulong*)(bits + pos); // Copy masked bits. + numBytes -= 8; + pos += 8; + } } - #endif // Copy 32bit blocks. while (numBytes >= 4) From 583f859c1b5badb9a42c7f4ce4af21aa982afaa0 Mon Sep 17 00:00:00 2001 From: leonardo Date: Wed, 3 Jun 2026 12:46:37 +0200 Subject: [PATCH 2/2] FIX: Use DEBUG instead of UNITY_ENABLE_CHECKS for DEVELOPMENT_BUILD replacement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UNITY_ENABLE_CHECKS is *not* equivalent to DEVELOPMENT_BUILD in player builds: the standalone-functional-tests CI run (job 69319540) failed to compile because in a Development Build with tests (UNITY_EDITOR=false, UNITY_INCLUDE_TESTS=true, DEVELOPMENT_BUILD=true), UNITY_ENABLE_CHECKS is not set, so the remoting block in InputSystem.cs was no longer compiled — but InputSystemTestHooks.cs (which is guarded by UNITY_EDITOR || UNITY_INCLUDE_TESTS) still referenced InputSystem.remoteConnection. DEBUG is the right managed-code-variant directive for this: it's defined in the debug C# code variant, which is the default for Development Builds. So `#if UNITY_EDITOR || DEBUG` matches the prior `#if UNITY_EDITOR || DEVELOPMENT_BUILD` semantic in all observed configurations. Updated 30 lines across 10 files plus the CHANGELOG entry. HID.cs and MemoryHelpers.cs unchanged from the previous commit (those don't involve UNITY_ENABLE_CHECKS). Co-Authored-By: Claude Opus 4.7 (1M context) --- Packages/com.unity.inputsystem/CHANGELOG.md | 2 +- .../Controls/InputControlExtensions.cs | 34 +++++++++---------- .../Runtime/Controls/InputControlList.cs | 4 +-- .../Runtime/Devices/Remote/InputRemoting.cs | 2 +- .../Runtime/Events/InputEventBuffer.cs | 2 +- .../InputSystem/Runtime/InputManager.cs | 4 +-- .../InputSystem/Runtime/InputSystem.cs | 6 ++-- .../InputSystem/Runtime/InputSystemState.cs | 2 +- .../EnhancedTouch/EnhancedTouchSupport.cs | 2 +- .../Plugins/PlayerInput/PlayerInputManager.cs | 2 +- .../Runtime/State/InputStateBuffers.cs | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index b142f837a0..cabb936869 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed InputSystem.onAnyButtonPress fails to trigger when the device receives a touch [UUM-137930](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-137930). - Fixed an incorrect ArraysHelper.HaveDuplicateReferences implementation that didn't use its arguments right [ISXB-1792] (https://github.com/Unity-Technologies/InputSystem/pull/2376) - Fixed `InputAction.IsPressed`, `WasPressedThisFrame`, and `WasReleasedThisFrame` using a `ButtonControl`'s `pressPoint` when a binding also had an explicit `PressInteraction` with its own `pressPoint`, which could make those APIs disagree with the interaction's press and release behavior. Action-level press APIs now follow the interaction threshold when both are set explicitly. -- Replaced deprecated `DEVELOPMENT_BUILD` and `UNITY_64` preprocessor directives flagged by the `UAC0008` / `UAC0009` analyzers on Unity 6000.6 (Package Validation rule `PVP-301-1`). `#if DEVELOPMENT_BUILD || UNITY_EDITOR` becomes `#if UNITY_EDITOR || UNITY_ENABLE_CHECKS`, `#if UNITY_64` becomes a runtime `IntPtr.Size == 8` check. Also added `[NonSerialized]` on `HID.HIDLayoutBuilder.deviceType` and `HID.HIDElementDescriptor.usageMin` / `usageMax` to silence `UAC1001`. No behavioural change. +- Replaced deprecated `DEVELOPMENT_BUILD` and `UNITY_64` preprocessor directives flagged by the `UAC0008` / `UAC0009` analyzers on Unity 6000.6 (Package Validation rule `PVP-301-1`). `#if DEVELOPMENT_BUILD || UNITY_EDITOR` becomes `#if UNITY_EDITOR || DEBUG` (`DEBUG` is the modern managed-code-variant equivalent that's defined in development player builds), `#if UNITY_64` becomes a runtime `IntPtr.Size == 8` check. Also added `[NonSerialized]` on `HID.HIDLayoutBuilder.deviceType` and `HID.HIDElementDescriptor.usageMin` / `usageMax` to silence `UAC1001`. No behavioural change. ### Changed - Action-level `IsPressed`, `WasPressedThisFrame`, and `WasReleasedThisFrame` for bindings to `Vector2Control` / `StickControl` no longer consult a per-control `pressPoint` on the vector (that field was removed). Use a `Press` interaction to set a custom threshold, or rely on `defaultButtonPressPoint`. diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs index 585666a042..7072548885 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs @@ -1616,7 +1616,7 @@ public struct ControlBuilder [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder At(InputDevice device, int index) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (device == null) throw new ArgumentNullException(nameof(device)); if (index < 0 || index >= device.m_ChildrenForEachControl.Length) @@ -1630,7 +1630,7 @@ public ControlBuilder At(InputDevice device, int index) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithParent(InputControl parent) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (parent == null) throw new ArgumentNullException(nameof(parent)); if (parent == control) @@ -1643,7 +1643,7 @@ public ControlBuilder WithParent(InputControl parent) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithName(string name) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); #endif @@ -1654,7 +1654,7 @@ public ControlBuilder WithName(string name) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithDisplayName(string displayName) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (string.IsNullOrEmpty(displayName)) throw new ArgumentNullException(nameof(displayName)); #endif @@ -1665,7 +1665,7 @@ public ControlBuilder WithDisplayName(string displayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithShortDisplayName(string shortDisplayName) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (string.IsNullOrEmpty(shortDisplayName)) throw new ArgumentNullException(nameof(shortDisplayName)); #endif @@ -1676,7 +1676,7 @@ public ControlBuilder WithShortDisplayName(string shortDisplayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithLayout(InternedString layout) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (layout.IsEmpty()) throw new ArgumentException("Layout name cannot be empty", nameof(layout)); #endif @@ -1687,7 +1687,7 @@ public ControlBuilder WithLayout(InternedString layout) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithUsages(int startIndex, int count) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (startIndex < 0 || startIndex >= control.device.m_UsagesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > control.device.m_UsagesForEachControl.Length) @@ -1701,7 +1701,7 @@ public ControlBuilder WithUsages(int startIndex, int count) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithAliases(int startIndex, int count) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (startIndex < 0 || startIndex >= control.device.m_AliasesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > control.device.m_AliasesForEachControl.Length) @@ -1715,7 +1715,7 @@ public ControlBuilder WithAliases(int startIndex, int count) [MethodImpl(MethodImplOptions.AggressiveInlining)] public ControlBuilder WithChildren(int startIndex, int count) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (startIndex < 0 || startIndex >= control.device.m_ChildrenForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > control.device.m_ChildrenForEachControl.Length) @@ -1754,7 +1754,7 @@ public ControlBuilder WithProcessor(TProcessor processor) where TValue : struct where TProcessor : InputProcessor { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (processor == null) throw new ArgumentNullException(nameof(processor)); #endif @@ -1808,7 +1808,7 @@ public struct DeviceBuilder [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithName(string name) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); #endif @@ -1819,7 +1819,7 @@ public DeviceBuilder WithName(string name) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithDisplayName(string displayName) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (string.IsNullOrEmpty(displayName)) throw new ArgumentNullException(nameof(displayName)); #endif @@ -1830,7 +1830,7 @@ public DeviceBuilder WithDisplayName(string displayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithShortDisplayName(string shortDisplayName) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (string.IsNullOrEmpty(shortDisplayName)) throw new ArgumentNullException(nameof(shortDisplayName)); #endif @@ -1841,7 +1841,7 @@ public DeviceBuilder WithShortDisplayName(string shortDisplayName) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithLayout(InternedString layout) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (layout.IsEmpty()) throw new ArgumentException("Layout name cannot be empty", nameof(layout)); #endif @@ -1852,7 +1852,7 @@ public DeviceBuilder WithLayout(InternedString layout) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithChildren(int startIndex, int count) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (startIndex < 0 || startIndex >= device.device.m_ChildrenForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(startIndex)); if (count < 0 || startIndex + count > device.device.m_ChildrenForEachControl.Length) @@ -1880,7 +1880,7 @@ public DeviceBuilder IsNoisy(bool value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithControlUsage(int controlIndex, InternedString usage, InputControl control) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (controlIndex < 0 || controlIndex >= device.m_UsagesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(controlIndex)); if (usage.IsEmpty()) @@ -1896,7 +1896,7 @@ public DeviceBuilder WithControlUsage(int controlIndex, InternedString usage, In [MethodImpl(MethodImplOptions.AggressiveInlining)] public DeviceBuilder WithControlAlias(int controlIndex, InternedString alias) { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (controlIndex < 0 || controlIndex >= device.m_AliasesForEachControl.Length) throw new ArgumentOutOfRangeException(nameof(controlIndex)); if (alias.IsEmpty()) diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs index c94de879af..32a66cacc6 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlList.cs @@ -45,7 +45,7 @@ namespace UnityEngine.InputSystem /// /// Type of to store in the list. [DebuggerDisplay("Count = {Count}")] - #if UNITY_EDITOR || UNITY_ENABLE_CHECKS + #if UNITY_EDITOR || DEBUG [DebuggerTypeProxy(typeof(InputControlListDebugView<>))] #endif public unsafe struct InputControlList : IList, IReadOnlyList, IDisposable @@ -597,7 +597,7 @@ public void Dispose() } } - #if UNITY_EDITOR || UNITY_ENABLE_CHECKS + #if UNITY_EDITOR || DEBUG internal struct InputControlListDebugView where TControl : InputControl { diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs index ec0af96c39..bc4002ad65 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Devices/Remote/InputRemoting.cs @@ -757,7 +757,7 @@ private static TData DeserializeData(byte[] data) return JsonUtility.FromJson(json); } -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG // State we want to take across domain reloads. We can only take some of the // state across. Subscriptions will be lost and have to be manually restored. [Serializable] diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs index 47a50819e1..67f134c67e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Events/InputEventBuffer.cs @@ -298,7 +298,7 @@ internal void AdvanceToNextEvent(ref InputEvent* currentReadPos, if (numRemainingEvents > 1) { // Don't perform safety check in non-debug builds. - #if UNITY_EDITOR || UNITY_ENABLE_CHECKS + #if UNITY_EDITOR || DEBUG newReadPos = InputEvent.GetNextInMemoryChecked(currentReadPos, ref this); #else newReadPos = InputEvent.GetNextInMemory(currentReadPos); diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs index 557abffec8..1dff2e4330 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputManager.cs @@ -4481,7 +4481,7 @@ private bool FlipBuffersForDeviceIfNecessary(InputDevice device, InputUpdateType // Stuff everything that we want to survive a domain reload into // a m_SerializedState. - #if UNITY_EDITOR || UNITY_ENABLE_CHECKS + #if UNITY_EDITOR || DEBUG [Serializable] internal struct DeviceState { @@ -4795,6 +4795,6 @@ private bool RestoreDeviceFromSavedState(ref DeviceState deviceState, InternedSt return true; } -#endif // UNITY_EDITOR || UNITY_ENABLE_CHECKS +#endif // UNITY_EDITOR || DEBUG } } diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs index db87363381..4fc50b9b39 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystem.cs @@ -3366,7 +3366,7 @@ public static bool runInBackground internal static InputManager s_Manager; internal static InputRemoting s_Remote; -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG private static RemoteInputPlayerConnection s_RemoteConnection; internal static RemoteInputPlayerConnection remoteConnection @@ -3411,7 +3411,7 @@ private static bool ShouldEnableRemoting() } #endif //!UNITY_EDITOR -#endif // UNITY_EDITOR || UNITY_ENABLE_CHECKS +#endif // UNITY_EDITOR || DEBUG // The rest here is internal stuff to manage singletons, survive domain reloads, // and to support the reset ability for tests. @@ -3506,7 +3506,7 @@ internal static void InitializeInPlayer(IInputRuntime runtime = null, bool loadS #endif // Automatically enable remoting in development players. - #if !UNITY_EDITOR && UNITY_ENABLE_CHECKS + #if !UNITY_EDITOR && DEBUG if (ShouldEnableRemoting()) SetUpRemoting(); #endif diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs index b27a023b87..25150fb3a9 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/InputSystemState.cs @@ -5,7 +5,7 @@ namespace UnityEngine.InputSystem { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG /// /// Snapshot of the state used by the input system. /// diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs index 588d8b2df7..f41c8299fa 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/EnhancedTouch/EnhancedTouchSupport.cs @@ -202,7 +202,7 @@ private static void OnBeforeDomainReload() #endif - [Conditional("UNITY_ENABLE_CHECKS")] + [Conditional("DEBUG")] [Conditional("UNITY_EDITOR")] internal static void CheckEnabled() { diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs index a912e8525c..7bb656bdcd 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/PlayerInput/PlayerInputManager.cs @@ -706,7 +706,7 @@ private bool IsDeviceUsableWithPlayerActions(InputDevice device) private void ValidateInputActionAsset() { -#if UNITY_EDITOR || UNITY_ENABLE_CHECKS +#if UNITY_EDITOR || DEBUG if (m_PlayerPrefab == null || m_PlayerPrefab.GetComponentInChildren() == null) return; diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs index ec9c9632e5..0299b85bae 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/State/InputStateBuffers.cs @@ -330,7 +330,7 @@ private static void MigrateDoubleBuffer(DoubleBuffers newBuffer, InputDevice[] d // NOTE: This also means that device indices of if (device.m_StateBlock.byteOffset == InputStateBlock.InvalidOffset) { - #if UNITY_EDITOR || UNITY_ENABLE_CHECKS + #if UNITY_EDITOR || DEBUG for (var n = i + 1; n < deviceCount; ++n) Debug.Assert(devices[n].m_StateBlock.byteOffset == InputStateBlock.InvalidOffset, "New devices must be appended to the array; found an old device coming in the array after a newly added device");