Skip to content

FIX: Input devices being lost up on upgrade to the new input version [ISX-2569]#2438

Open
K-Tone wants to merge 1 commit into
developfrom
anthony/isx-2569-fix-fepm-upgrade-device-loss
Open

FIX: Input devices being lost up on upgrade to the new input version [ISX-2569]#2438
K-Tone wants to merge 1 commit into
developfrom
anthony/isx-2569-fix-fepm-upgrade-device-loss

Conversation

@K-Tone

@K-Tone K-Tone commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description

So the problem we're trying to fix here is that when you have a working project with pre-FEPM InputSystem and you then update the input package to the one that has the FEPM change, all input comes broken. The root problem appeared that all devices were lost during upgrade.

The reason devices got lost during upgrade is somewhat tricky to explain, but it all comes down to the fact that native will only communicate the current devices once per Unity process. If you lose devices once, it's permanent - entering playmode doesn't list devices again.

The way we lost devices was due to us renaming an in-memory scriptable object class that was used to keep state from InputSystemObject to InputSystemStateManager. Up on upgrade recompilation, Unity realised that the class for the InputSystemObject SO is no longer available so it shall be dropped, and all the devices died with it.

Hereby, we bring back the old class with the old meta info so that the forward upgrade can work for now.

Testing status & QA

Tried locally.

Overall Product Risks

  • Complexity: Low
  • Halo Effect: Low

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

Focused fix for a script GUID mismatch that ensures input devices survive the upgrade process.

🤖 Helpful? 👍/👎

@K-Tone K-Tone requested review from Pauliusd01 and ekcoh June 15, 2026 18:04
@codecov-github-com

codecov-github-com Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 5.55556% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...InputSystem/Editor/InputSystemEditorInitializer.cs 5.55% 17 Missing ⚠️
@@             Coverage Diff              @@
##           develop    #2438       +/-   ##
============================================
+ Coverage    58.58%   79.01%   +20.43%     
============================================
  Files          738      765       +27     
  Lines       135831   140359     +4528     
============================================
+ Hits         79570   110902    +31332     
+ Misses       56261    29457    -26804     
Flag Coverage Δ
inputsystem_MacOS_6000.0 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.0_project 77.46% <5.55%> (+0.21%) ⬆️
inputsystem_MacOS_6000.3 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.3_project 77.46% <5.55%> (+0.23%) ⬆️
inputsystem_MacOS_6000.4 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.4_project 77.47% <5.55%> (+0.23%) ⬆️
inputsystem_MacOS_6000.5 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.5_project 77.50% <5.55%> (+0.24%) ⬆️
inputsystem_MacOS_6000.6 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.6_project 77.50% <5.55%> (+0.24%) ⬆️
inputsystem_Ubuntu_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.37% <5.55%> (+0.21%) ⬆️
inputsystem_Ubuntu_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.36% <5.55%> (+0.24%) ⬆️
inputsystem_Ubuntu_6000.4 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4_project 77.38% <5.55%> (+0.24%) ⬆️
inputsystem_Ubuntu_6000.5 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.5_project 77.41% <5.55%> (+0.24%) ⬆️
inputsystem_Ubuntu_6000.6 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.6_project 77.41% <5.55%> (+0.24%) ⬆️
inputsystem_Windows_6000.0 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.0_project 77.59% <5.55%> (+0.21%) ⬆️
inputsystem_Windows_6000.3 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.3_project 77.58% <5.55%> (+0.23%) ⬆️
inputsystem_Windows_6000.4 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.4_project 77.59% <5.55%> (+0.23%) ⬆️
inputsystem_Windows_6000.5 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.5_project 77.63% <5.55%> (+0.24%) ⬆️
inputsystem_Windows_6000.6 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.6_project 77.63% <5.55%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...InputSystem/Editor/InputSystemEditorInitializer.cs 72.61% <5.55%> (+70.25%) ⬆️

... and 278 files with indirect coverage changes

ℹ️ Need help interpreting these results?

@Pauliusd01

Copy link
Copy Markdown
Collaborator

/test_plan

@u-pr

u-pr Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Test Plan

  • Test plan approved by PR author
  • Test execution in progress
  • Test execution complete
  • Ready for merge

Summary of Changes & Risk Assessment

Summary of Changes

This PR fixes a critical issue where input devices are lost during a package upgrade (specifically related to the Fast Enter Play Mode changes). The fix involves re-introducing a legacy InputSystemObject class with its original GUID to act as a bridge. When the Editor initializes, it now checks for surviving instances of the legacy InputSystemObject, migrates the serialized state (including connected devices) to the new InputSystemStateManager, and then cleans up the legacy instance.

Risk Assessment

  • High Risk Areas: None identified.
  • Medium Risk Areas: Editor initialization sequence, Package upgrade/migration path.
  • Low Risk Areas: Serialization of state fields, Changelog updates.

Test Scenarios

Functional Testing

  • State Migration Verification: Manually create a ScriptableObject of type InputSystemObject (mimicking a pre-upgrade state), populate its fields, and verify that upon domain reload, the data is correctly transferred to a new InputSystemStateManager instance in InputSystemEditorInitializer.InitializeInEditor.
  • Device Persistence on Upgrade: Simulate a package upgrade from a version prior to the FEPM change to this branch. Verify that devices (Keyboard, Mouse, etc.) remain active and listed in the Input Debugger without requiring an Editor restart.
  • GUID Validation: Confirm that Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemObject.cs.meta contains the GUID 5cdce2bffd1e49bda08b3db54a031207 as required for the legacy reference to resolve.
  • Cleanup Verification: Verify that any detected InputSystemObject instances are successfully destroyed after migration using Object.DestroyImmediate to prevent redundant migration on subsequent reloads.

Regression Testing

  • Clean Initialization: Verify that a fresh project install or a project already on the new version (which only has InputSystemStateManager) initializes correctly without errors and does not attempt to create legacy objects.
  • Domain Reload Stability: Perform standard domain reloads (e.g., script changes) and verify that the InputSystemStateManager correctly maintains state without looking for legacy objects once they have been migrated.
  • Play Mode Transition: Verify that the fix does not interfere with the Fast Enter Play Mode (FEPM) logic, ensuring exitEditModeTime and enterPlayModeTime are still handled correctly in the new manager.

Edge Cases

  • Multiple Legacy Objects: Verify behavior if multiple instances of InputSystemObject are found by Resources.FindObjectsOfTypeAll. The logic should migrate from one and destroy all to prevent state duplication.
  • Partial State Serialization: Verify that if the legacy object exists but has null or default fields (e.g., empty settings string), the migration does not crash the Editor initialization.

💡 This test plan updates automatically when /test_plan is run on new commits. If you have any feedback, please reach out in #ai-qa


🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr

@ekcoh ekcoh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I fully understand this fix but looks like fixing broken serialisation. The key takeaway here IMO is that this (not this PR; but how this work) is the wrong solution to the problem. I will link this issue/PR as a motivational case for why device ownership, enumeration, reconnects should live in the module (native) and not in the package. This would make this + any serialisation push/pop disappear from the package. Good fix!

@K-Tone

K-Tone commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the input Hakan! I would have totally loved if we could poll data from native at certain points instead of messing with ScriptableObjects. We do know keeping data is needed, just that if we keep copies in managed that appears to cost much more. I would have totally loved trying to minimise our managed state that needs to survive domain reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants