FIX: Silence Unity 6000.6 PVP-301-1 deprecation analyzers (DEVELOPMENT_BUILD / UNITY_64)#2427
Closed
LeoUnity wants to merge 2 commits into
Closed
FIX: Silence Unity 6000.6 PVP-301-1 deprecation analyzers (DEVELOPMENT_BUILD / UNITY_64)#2427LeoUnity wants to merge 2 commits into
LeoUnity wants to merge 2 commits into
Conversation
…ed by Unity 6000.6 PVP-301-1
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) <noreply@anthropic.com>
Comment on lines
+247
to
+253
| 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; | ||
| } |
Contributor
There was a problem hiding this comment.
Have you considered hoisting the 64-bit fill value calculation outside of the while loop? Since value is loop-invariant, calculating it once before the loop avoids redundant bit-shifting and bitwise operations on every iteration. This can significantly improve performance when filling larger buffers.
🤖 Helpful? 👍/👎 by guardian
…eplacement 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) <noreply@anthropic.com>
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## develop #2427 +/- ##
===========================================
+ Coverage 78.13% 78.92% +0.79%
===========================================
Files 483 762 +279
Lines 98770 139280 +40510
===========================================
+ Hits 77169 109926 +32757
- Misses 21601 29354 +7753 Flags with carried forward coverage won't be shown. Click here to find out more.
|
Collaborator
Author
|
#2425 Darren is already working on it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unity 6000.6 (alpha) added Package Validator Plugin rule PVP-301-1 that fails
Validate - inputsystem - 6000.6 - {macos13, ubuntu2204, win10}jobs on three deprecated patterns flagged by theUAC0008/UAC0009/UAC1001analyzers. All 35 flagged sites exist on develop today and are pre-existing; this PR cleans them up so 6000.6 Validate goes green across all PRs.No behavioural change is intended. The deprecated directives are mapped one-to-one to their modern Unity-6 equivalents.
What this PR does NOT do
It does not touch any other PVP rule. The other PVP errors visible in
validate-6006-mac-pvp/upm-ci~/pvp/com.unity.inputsystem.result.json(PVP-33-1, PVP-40-1, PVP-84-2, PVP-91-2, etc.) are already baselined in.yamato/wrench/pvp-exemptions.jsonand don't cause Validate to fail — only PVP-301-1 was unhandled. Confirmed in the failing job's Yamato log:Match found: PVP-301-1is the sole finding.Replacements
UAC0009#if DEVELOPMENT_BUILD || UNITY_EDITOR(and reversed)#if UNITY_EDITOR || DEBUGUAC0009#if DEVELOPMENT_BUILD(no editor)#if !UNITY_EDITOR && DEBUGInputSystem.cs:3509, preserves "dev-player only, not editor" semantic)UAC0009[Conditional("DEVELOPMENT_BUILD")][Conditional("DEBUG")]EnhancedTouchSupport.cs:205)UAC0008#if UNITY_64if (IntPtr.Size == 8)runtime checkMemoryHelpers.cs(MemSet, MemCpyMasked 64-bit fast paths)UAC1001[Serializable]struct[NonSerialized]HID.cs:HIDLayoutBuilder.deviceType(System.Type),HIDElementDescriptor.usageMin/usageMax(int?)Why
DEBUGand notUNITY_ENABLE_CHECKS?The analyzer hint lists three modern alternatives —
DEBUG,UNITY_ENABLE_CHECKS, andUNITY_INCLUDE_INSTRUMENTATION. The first revision of this PR usedUNITY_ENABLE_CHECKSand broke the standalone-functional-tests run (Yamato job 69319540): in a Development Build with tests (UNITY_EDITOR=false,UNITY_INCLUDE_TESTS=true,DEVELOPMENT_BUILD=true),UNITY_ENABLE_CHECKSis not set, so the remoting block inInputSystem.cswas no longer compiled andInputSystemTestHooks.cslost itsInputSystem.remoteConnectionsymbol.DEBUGis the right managed-code-variant directive: it's defined in the debug C# code variant, which is the default for Development Builds. So#if UNITY_EDITOR || DEBUGmatches the prior#if UNITY_EDITOR || DEVELOPMENT_BUILDsemantic in all observed configurations.Other notes on the rewrites
UNITY_64sites, the JIT folds theIntPtr.Size == 8branch on 64-bit targets, so the 8-byte-block fast paths still execute on x64/ARM64 with no measurable overhead.HID.cs[NonSerialized]additions only make explicit what Unity's serialiser was already doing (skipping fields with non-serialisable types) — no on-disk or runtime state-block change.Test plan
Validate - inputsystem - 6000.6 - macos13 / ubuntu2204 / win10go green (the targeted goal).UNITY_ENABLE_CHECKSmistake.ControlBuilder.WithName(null)/ similar (i.e.DEBUGis defined in editor as expected).Notes
develop(not from FIX: HID 8-bit hat switch crashes InputDeviceBuilder (UUM-143659) #2424's branch) — these two land independently.🤖 Generated with Claude Code