Repository navigation
FIX: [Port] Fixed CS0246 'InputSystemState' compile error in release Player builds with UNITY_INCLUDE_TESTS - #2513
Open
unitydavidlo wants to merge 1 commit into
Conversation
…Player builds with UNITY_INCLUDE_TESTS The 1.20.2 port of the trunk fix (ISX-2788) only brought over the InputSystem.remoteConnection change. The test framework assembly still needs InputSystemState, InputManager.SaveState and InputRemoting.SaveState, which were guarded by DEBUG and so missing in non-development Player builds that include test assemblies. Guard them with UNITY_EDITOR || UNITY_INCLUDE_TESTS as trunk does, and do the same for the DEVELOPMENT_BUILD guards in InputTestFixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
💡 Harness Review
The guard changes consistently enable state snapshots and fixture save/restore in release Players that include tests. I examined the affected code, callers, helper guards, test assembly configuration, and changelog and found no actionable issues.
Reviewed commit 3f0d06b
🤖 Helpful? 👍/👎
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2513 +/- ##
========================================
Coverage 79.22% 79.22%
========================================
Files 769 769
Lines 141300 141300
========================================
Hits 111939 111939
Misses 29361 29361
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Description
Follow-up to #2508, which didn't fully fix the problem.
The problem: a non-development Player build that includes test assemblies, with the
UNITY_INCLUDE_TESTSscripting define set, still fails to compile with 1.20.2:A customer reported this after updating to 1.20.2. It's the same customer who reported the
remoteConnectionerror.Why: #2508 ported only the
InputSystem.cspart of the trunk fix (ISX-2788). The trunk fix also changed the guards on the save/restore state code that theUnity.InputSystem.TestFrameworkassembly uses. Indevelopthat code is still behind#if DEBUG, andDEBUGis only defined in development builds:InputSystemState(#if DEBUG)InputManager.SaveState/DeviceState/SerializedState(#if DEBUG)InputRemoting.SaveState/SerializedState(#if DEBUG)I said in #2508 that the other files in the trunk change only applied to trunk. That was wrong for these.
The fix: use the same guards as trunk:
#if UNITY_EDITOR || UNITY_INCLUDE_TESTS.InputTestFixturecallsSaveAndReset/Restoreunder#if UNITY_EDITOR || UNITY_INCLUDE_TESTSinstead of#if DEVELOPMENT_BUILD || UNITY_EDITOR.Testing status & QA
I made macOS Player builds with Unity 6000.3.25f1:
developbefore this changeUNITY_INCLUDE_TESTS,BuildOptions.IncludeTestAssembliesUNITY_INCLUDE_TESTSThe test assemblies have to be included in the build to hit this, for example with
BuildOptions.IncludeTestAssemblies. SettingUNITY_INCLUDE_TESTSon its own doesn't compileUnity.InputSystem.TestFrameworkinto the Player. My testing for #2508 didn't include them, so it missed this.QA suggestion:
UNITY_INCLUDE_TESTSset and test assemblies included. It should compile.There's no automated test, for the same reason as #2508: our CI only makes development builds for tests.
Overall Product Risks
UNITY_INCLUDE_TESTSthat code is no longer compiled, and nothing outside the Editor and the test framework uses it. A development build withoutUNITY_INCLUDE_TESTSstill compiles.Comments to reviewers
The changes match trunk's guards for these files.
There's no issue-tracker case yet. I'll add the ID to the title and changelog once there is one.
This PR was prepared by Claude Code (an AI coding agent).
Checklist
Before review:
During merge:
FIX: ___.🤖 Generated with Claude Code