X Tutup
Skip to content

Input system/cache properties#2370

Draft
josepmariapujol-unity wants to merge 3 commits intodevelopfrom
input-system/cache-properties
Draft

Input system/cache properties#2370
josepmariapujol-unity wants to merge 3 commits intodevelopfrom
input-system/cache-properties

Conversation

@josepmariapujol-unity
Copy link
Collaborator

Description

Please fill this section with a description what the pull request is trying to address and what changes were made.

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 draft March 9, 2026 12:25
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.

Good

This pull request makes improvements to the PlayerInputManagerEditor. While the changes are generally sound, there are a few issues regarding unnecessary serialized property writes that could impact performance or the undo system, as well as some minor inconsistencies in API usage and lifecycle management.

🤖 Helpful? 👍/👎

EditorGUILayout.PropertyField(m_MaxPlayerCountProperty);
--EditorGUI.indentLevel;
}
else
Copy link
Contributor

Choose a reason for hiding this comment

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

importance-medium

Assigning a value to m_MaxPlayerCountProperty.intValue inside the else block of OnInspectorGUI will result in an unconditional write to the serialized property on every GUI event (Layout, Repaint, etc.) whenever the toggle is disabled. This can cause the SerializedObject to be marked dirty unnecessarily and may interfere with the Undo system or performance in large scenes. Consider wrapping this assignment in a check to see if the value is already -1, or perform the assignment only when m_MaxPlayerCountEnabled changes.

🤖 Helpful? 👍/👎

m_FixedNumberOfSplitScreensLabel = EditorGUIUtility.TrTextContent("Number of Screens",
fixedNumberProperty.tooltip);
EditorGUILayout.PropertyField(fixedNumberProperty, m_FixedNumberOfSplitScreensLabel);
m_FixedNumberOfSplitScreensProperty.tooltip);
Copy link
Contributor

Choose a reason for hiding this comment

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

importance-low

There is an inconsistency in how tooltips are accessed. On line 199, GetTooltip() is used, while here .tooltip is accessed directly. It is generally recommended to stick to one method (likely GetTooltip() if it handles fallbacks or version compatibility) to ensure consistent behavior across the editor.

🤖 Helpful? 👍/👎

else
{
fixedNumberProperty.intValue = -1;
m_FixedNumberOfSplitScreensProperty.intValue = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

importance-medium

Similar to the m_MaxPlayerCountProperty assignment, this unconditionally sets the property value to -1 on every repaint when m_FixedNumberOfSplitScreensEnabled is false. This should ideally be guarded by a change check or a value comparison to avoid unnecessary dirtiness of the serialized object.

🤖 Helpful? 👍/👎

Comment on lines +256 to +267
[NonSerialized] private SerializedProperty m_NotificationBehaviorProperty;
[NonSerialized] private SerializedProperty m_PlayerJoinedEventProperty;
[NonSerialized] private SerializedProperty m_PlayerLeftEventProperty;
[NonSerialized] private SerializedProperty m_JoinBehaviorProperty;
[NonSerialized] private SerializedProperty m_JoinActionProperty;
[NonSerialized] private SerializedProperty m_PlayerPrefabProperty;
[NonSerialized] private SerializedProperty m_AllowJoiningProperty;
[NonSerialized] private SerializedProperty m_MaxPlayerCountProperty;
[NonSerialized] private SerializedProperty m_SplitScreenProperty;
[NonSerialized] private SerializedProperty m_MaintainAspectRatioProperty;
[NonSerialized] private SerializedProperty m_FixedNumberOfSplitScreensProperty;
[NonSerialized] private SerializedProperty m_SplitScreenRectProperty;
Copy link
Contributor

Choose a reason for hiding this comment

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

importance-low

The [NonSerialized] fields for SerializedProperty are correctly added to avoid serialization overhead. However, since OnEnable caches these, ensure that OnDisable or the class doesn't leak references if the SerializedObject is disposed. While typically handled by Unity's garbage collection for Editor objects, it's a good practice to null them out in OnDisable if the editor lifecycle is complex.

🤖 Helpful? 👍/👎

@codecov-github-com
Copy link

codecov-github-com bot commented Mar 9, 2026

Codecov Report

Attention: Patch coverage is 37.50000% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...em/Plugins/PlayerInput/PlayerInputManagerEditor.cs 33.33% 30 Missing ⚠️
@@             Coverage Diff             @@
##           develop    #2370      +/-   ##
===========================================
- Coverage    77.90%   77.90%   -0.01%     
===========================================
  Files          476      476              
  Lines        97613    97649      +36     
===========================================
+ Hits         76048    76072      +24     
- Misses       21565    21577      +12     
Flag Coverage Δ
inputsystem_MacOS_2022.3 5.52% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_2022.3_project 75.40% <37.50%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.0 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.0_project 77.30% <37.50%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.3 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.3_project 77.30% <37.50%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.4 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.4_project 77.31% <37.50%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.5 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.5_project 77.30% <37.50%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.6 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.6_project 77.30% <37.50%> (+<0.01%) ⬆️
inputsystem_Ubuntu_2022.3_project 75.19% <37.50%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.0 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.11% <37.50%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.3 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.10% <37.50%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.4 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4_project 77.11% <37.50%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.5 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.5_project 77.11% <37.50%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.6 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.6_project 77.11% <37.50%> (+<0.01%) ⬆️
inputsystem_Windows_2022.3 5.52% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_2022.3_project 75.52% <37.50%> (+<0.01%) ⬆️
inputsystem_Windows_6000.0 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.0_project 77.43% <37.50%> (+<0.01%) ⬆️
inputsystem_Windows_6000.3 5.30% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.3_project 77.43% <37.50%> (+<0.01%) ⬆️
inputsystem_Windows_6000.4 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.4_project 77.43% <37.50%> (+<0.01%) ⬆️
inputsystem_Windows_6000.5 5.31% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.5_project 77.43% <37.50%> (+<0.01%) ⬆️
inputsystem_Windows_6000.6_project 77.43% <37.50%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
...s/com.unity.inputsystem/InputSystem/InputSystem.cs 84.18% <ø> (-0.20%) ⬇️
...ty.inputsystem/InputSystem/Plugins/UI/UISupport.cs 100.00% <100.00%> (ø)
...em/Plugins/PlayerInput/PlayerInputManagerEditor.cs 17.46% <33.33%> (+8.88%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant

X Tutup