Skip to content

FIX: InputSystem warnings displayed with Unity editor 6000.6 version#2381

Merged
josepmariapujol-unity merged 7 commits intodevelopfrom
input/warnings-6000.6a
Mar 13, 2026
Merged

FIX: InputSystem warnings displayed with Unity editor 6000.6 version#2381
josepmariapujol-unity merged 7 commits intodevelopfrom
input/warnings-6000.6a

Conversation

@josepmariapujol-unity
Copy link
Collaborator

@josepmariapujol-unity josepmariapujol-unity commented Mar 12, 2026

Description

InputSystem warnings displayed with Unity editor 6000.6 version.

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs(22,58): warning UAC1010: Field 'm_State' has [SerializeField] but its type 'UnityEngine.InputSystem.Editor.InputActionsEditorState' is not [Serializable]; Unity will ignore this field. Consider replacing [SerializeField] with [System.NonSerialized] or make the type [Serializable] if serialization is desired.

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs(22,58): warning UAC1010: Field 'm_State' has [SerializeField] but its type 'UnityEngine.InputSystem.Editor.InputActionsEditorState' is not [Serializable]; Unity will ignore this field. Consider replacing [SerializeField] with [System.NonSerialized] or make the type [Serializable] if serialization is desired.

Packages/com.unity.inputsystem/InputSystem/Devices/Remote/InputRemoting.cs(383,37): warning UAC1001: Field 'layouts' is a candidate for serialization but Unity will skip it because its type 'UnityEngine.InputSystem.Utilities.InternedString' lacks [Serializable] attribute. To fix this, either: make the field private (if serialization is not desired), add [System.NonSerialized] (to explicitly mark it as non-serialized), or add [Serializable] to type 'UnityEngine.InputSystem.Utilities.InternedString' (if serialization is desired).

Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputStateWindow.cs(403,43): warning UAC1009: Field 'm_StateBuffers' uses 'byte[][]' which is not supported by Unity serialization (multidimensional arrays, jagged arrays, dictionaries, and other unsupported collections are not serialized); consider adding [System.NonSerialized] to suppress this warning

Packages/com.unity.inputsystem/InputSystem/InputManager.cs(4332,38): warning UAC1001: Field 'buffers' is a candidate for serialization but Unity will skip it because its type 'UnityEngine.InputSystem.LowLevel.InputStateBuffers' lacks [Serializable] attribute. To fix this, either: make the field private (if serialization is not desired), add [System.NonSerialized] (to explicitly mark it as non-serialized), or add [Serializable] to type 'UnityEngine.InputSystem.LowLevel.InputStateBuffers' (if serialization is desired).

Packages/com.unity.inputsystem/InputSystem/Events/InputEventTrace.cs(1567,46): warning UAC1010: Field 'm_StateFormat' has [SerializeField] but its type 'UnityEngine.InputSystem.Utilities.FourCC' is not [Serializable]; Unity will ignore this field. Consider replacing [SerializeField] with [System.NonSerialized] or make the type [Serializable] if serialization is desired.

Assets/Tests/InputSystem.Editor/InputActionReferenceEditorTests.cs(101,59): warning CS0618: 'Object.FindFirstObjectByType<T>()' is obsolete: 'FindFirstObjectByType has been deprecated because it relies on instance ID ordering. Use FindAnyObjectByType instead, which does not depend on ordering.'

Assets/QA/Tests/Xbox Controller Basic/Scripts/GamepadButtonState.cs(9,26): warning UAC1001: Field 'buttonToTrack' is a candidate for serialization but Unity will skip it because its type 'UnityEngine.InputSystem.Controls.ButtonControl' lacks [Serializable] attribute. To fix this, either: make the field private (if serialization is not desired), add [System.NonSerialized] (to explicitly mark it as non-serialized), or add [Serializable] to type 'UnityEngine.InputSystem.Controls.ButtonControl' (if serialization is desired).

Assets/Tests/InputSystem/Plugins/UITests.cs(4626,28): warning UAC1001: Field 'events' is a candidate for serialization but Unity will skip it because its type 'UITests.UICallbackReceiver.Event' lacks [Serializable] attribute. To fix this, either: make the field private (if serialization is not desired), add [System.NonSerialized] (to explicitly mark it as non-serialized), or add [Serializable] to type 'UITests.UICallbackReceiver.Event' (if serialization is desired).

Some of the warnings:
image

Testing status & QA

Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity:
  • Halo Effect:

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

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.

@josepmariapujol-unity josepmariapujol-unity marked this pull request as ready for review March 12, 2026 16:12
@josepmariapujol-unity
Copy link
Collaborator Author

/crc

@josepmariapujol-unity
Copy link
Collaborator Author

/review

Copy link
Contributor

@u-pr u-pr bot left a comment

Choose a reason for hiding this comment

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

May require changes
The review identified critical serialization issues. Marking types with readonly fields or unmanaged pointers as [Serializable] will likely result in data loss or memory access violations. Additionally, there are concerns about serialization graph bloat for core controls.

🤖 Helpful? 👍/👎

Copy link
Contributor

@u-pr u-pr bot left a comment

Choose a reason for hiding this comment

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

May require changes

This review identified a few new points regarding the recent serialization changes:

  • Functional Issue (High): FourCC will lose its data during serialization because its private field is not marked with [SerializeField].
  • Verification Needed (Low): Ensure base classes of AxisControl are serializable to prevent data loss after deserialization.
  • Best Practice (Low): Marking m_StateBuffers in InputStateWindow as [NonSerialized] is a good practice as Unity does not support jagged array serialization.

Several other points (regarding InternedString, InputStateBuffers, and UITests) were excluded as they were already covered by existing comments.

🤖 Helpful? 👍/👎

@josepmariapujol-unity
Copy link
Collaborator Author

/review

@josepmariapujol-unity
Copy link
Collaborator Author

/crc

Copy link
Contributor

@u-pr u-pr bot left a comment

Choose a reason for hiding this comment

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

May require changes

This review identified a critical architectural issue regarding the serialization of core input classes. While the PR aims to improve serializability for various components, marking the base InputControl class as [Serializable] introduces significant risks related to unmanaged memory and object initialization that could lead to runtime crashes.

🤖 Helpful? 👍/👎

@u-pr
Copy link
Contributor

u-pr bot commented Mar 12, 2026

PR Reviewer Guide 🔍

(Review updated until commit bed62b2)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪

The diff is small and mostly consists of attribute additions and a couple of editor/test adjustments, but it warrants a quick verification pass for behavioral side-effects.

🏅 Score: 90

The changes are straightforward and likely fix the reported warnings, with a few spots that should be validated for determinism and persistence behavior.

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Test Determinism

Object.FindAnyObjectByType<T>() can return a non-deterministic instance when multiple objects of the same type exist; confirm the test scene/setup guarantees a single InputActionBehaviour instance (or consider a deterministic selection strategy if not).

private static InputActionBehaviour GetBehaviour() => Object.FindAnyObjectByType<InputActionBehaviour>();
private static InputActionAsset GetAsset() => AssetDatabase.LoadAssetAtPath<InputActionAsset>(assetPath);
State Persistence

Changing m_StateBuffers from serialized to non-serialized means it won’t survive domain reloads/serialization cycles; ensure the window correctly rebuilds buffers on enable/selection changes and handles null safely.

[NonSerialized] private byte[][] m_StateBuffers;
[SerializeField] private int m_SelectedStateBuffer;
[SerializeField] private bool m_CompareStateBuffers;
[SerializeField] private bool m_ShowDifferentOnly;
Serialization Impact

Adding [Serializable] to foundational types (e.g., InputControl and InputControl<TValue>) can affect Unity/editor serialization and reflection behavior; validate this doesn’t cause unintended serialization attempts, inspector exposure, or compatibility issues in user projects.

[Serializable]
[DebuggerDisplay("{DebuggerDisplay(),nq}")]
public abstract class InputControl
{
  • Update review

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

@u-pr
Copy link
Contributor

u-pr bot commented Mar 12, 2026

Persistent review updated to latest commit bed62b2

@codecov-github-com
Copy link

codecov-github-com bot commented Mar 12, 2026

Codecov Report

All modified and coverable lines are covered by tests ✅

@@             Coverage Diff             @@
##           develop    #2381      +/-   ##
===========================================
- Coverage    77.90%   77.89%   -0.02%     
===========================================
  Files          476      481       +5     
  Lines        97613    97691      +78     
===========================================
+ Hits         76048    76098      +50     
- Misses       21565    21593      +28     
Flag Coverage Δ
inputsystem_MacOS_2022.3 5.50% <ø> (-0.03%) ⬇️
inputsystem_MacOS_2022.3_project 75.41% <100.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.0 5.28% <ø> (-0.03%) ⬇️
inputsystem_MacOS_6000.0_project 77.31% <100.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.3 5.28% <ø> (-0.03%) ⬇️
inputsystem_MacOS_6000.3_project 77.31% <100.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.4 5.28% <ø> (-0.03%) ⬇️
inputsystem_MacOS_6000.4_project 77.32% <100.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.5 5.28% <ø> (-0.03%) ⬇️
inputsystem_MacOS_6000.5_project 77.31% <100.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.6 5.28% <ø> (-0.03%) ⬇️
inputsystem_MacOS_6000.6_project 77.31% <100.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_2022.3_project 75.20% <100.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.0 5.28% <ø> (-0.03%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.11% <100.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.3 5.28% <ø> (-0.03%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.11% <100.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.4 5.29% <ø> (-0.03%) ⬇️
inputsystem_Ubuntu_6000.4_project 77.12% <100.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.5 5.29% <ø> (-0.03%) ⬇️
inputsystem_Ubuntu_6000.5_project 77.12% <100.00%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.6 5.29% <ø> (-0.03%) ⬇️
inputsystem_Ubuntu_6000.6_project 77.12% <100.00%> (+0.01%) ⬆️
inputsystem_Windows_2022.3 5.50% <ø> (-0.03%) ⬇️
inputsystem_Windows_2022.3_project 75.53% <100.00%> (+<0.01%) ⬆️
inputsystem_Windows_6000.0 5.28% <ø> (-0.03%) ⬇️
inputsystem_Windows_6000.0_project 77.43% <100.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.3 5.28% <ø> (-0.03%) ⬇️
inputsystem_Windows_6000.3_project 77.43% <100.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.4 5.28% <ø> (-0.03%) ⬇️
inputsystem_Windows_6000.4_project 77.44% <100.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.5 5.28% <ø> (-0.03%) ⬇️
inputsystem_Windows_6000.5_project 77.44% <100.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.6 5.28% <ø> (-0.03%) ⬇️
inputsystem_Windows_6000.6_project 77.44% <100.00%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
...utSystem.Editor/InputActionReferenceEditorTests.cs 97.61% <100.00%> (ø)
Assets/Tests/InputSystem/Plugins/UITests.cs 94.67% <ø> (ø)
...ty.inputsystem/InputSystem/Controls/AxisControl.cs 93.97% <ø> (ø)
....inputsystem/InputSystem/Controls/ButtonControl.cs 88.23% <ø> (ø)
...y.inputsystem/InputSystem/Controls/InputControl.cs 83.40% <ø> (ø)
...em/InputSystem/Editor/Internal/InputStateWindow.cs 0.00% <ø> (ø)
.../Editor/UITKAssetEditor/InputActionsEditorState.cs 53.36% <ø> (ø)
...inputsystem/InputSystem/State/InputStateBuffers.cs 96.11% <ø> (ø)
....unity.inputsystem/InputSystem/Utilities/FourCC.cs 68.62% <ø> (ø)

... and 7 files with indirect coverage changes

@josepmariapujol-unity
Copy link
Collaborator Author

@jfreire-unity

@Pauliusd01
Copy link
Collaborator

There seems to be one more warning left over:

Packages\com.unity.inputsystem\InputSystem\Devices\Remote\InputRemoting.cs(383,37): warning UAC1001: Field 'layouts' is a candidate for serialization but Unity will skip it because its type 'UnityEngine.InputSystem.Utilities.InternedString' lacks [Serializable] attribute. To fix this, either: make the field private (if serialization is not desired), add [System.NonSerialized] (to explicitly mark it as non-serialized), or add [Serializable] to type 'UnityEngine.InputSystem.Utilities.InternedString' (if serialization is desired).

@josepmariapujol-unity
Copy link
Collaborator Author

josepmariapujol-unity commented Mar 13, 2026

There seems to be one more warning left over:

Packages\com.unity.inputsystem\InputSystem\Devices\Remote\InputRemoting.cs(383,37): warning UAC1001: Field 'layouts' is a candidate for serialization but Unity will skip it because its type 'UnityEngine.InputSystem.Utilities.InternedString' lacks [Serializable] attribute. To fix this, either: make the field private (if serialization is not desired), add [System.NonSerialized] (to explicitly mark it as non-serialized), or add [Serializable] to type 'UnityEngine.InputSystem.Utilities.InternedString' (if serialization is desired).

Yes! I am not sure how to fix that. AI reviews are confusing me a lot.

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

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

Thanks for addressing these @josepmariapujol-unity!

@josepmariapujol-unity josepmariapujol-unity merged commit e1a0db7 into develop Mar 13, 2026
129 checks passed
@josepmariapujol-unity josepmariapujol-unity deleted the input/warnings-6000.6a branch March 13, 2026 12:06
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