Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed

- Improved New Input System warning dialog, Native Device Inputs Not Enabled [UUM-132151].
- Fixed caching for InputControlPath display name [ISX-2501](https://jira.unity3d.com/browse/ISX-2501)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@
return;
}

////TODO: this should be cached; generates needless GC churn
var displayName = InputControlPath.ToHumanReadableString(path);
// Cache the display name per path value and only recompute when the string actually changes.
if (!string.Equals(path, m_CachedPath, StringComparison.InvariantCultureIgnoreCase))
{
m_CachedPath = path;
m_CachedDisplayName = InputControlPath.ToHumanReadableString(path);
}

Check warning on line 131 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L127-L131

Added lines #L127 - L131 were not covered by tests

// Either show dropdown control that opens path picker or show path directly as
// text, if manual path editing is toggled on.
Expand All @@ -146,7 +150,7 @@
else
{
// Dropdown that shows binding text and allows opening control picker.
if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(displayName), FocusType.Keyboard))
if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(m_CachedDisplayName), FocusType.Keyboard))

Check warning on line 153 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L153

Added line #L153 was not covered by tests
{
SetExpectedControlLayoutFromAttribute(serializedProperty);
////TODO: for bindings that are part of composites, use the layout information from the [InputControl] attribute on the field
Expand Down Expand Up @@ -209,6 +213,9 @@
private string m_ExpectedControlLayout;
private string[] m_ControlPathsToMatch;

private string m_CachedPath;
private string m_CachedDisplayName;

private InputControlPickerDropdown m_PickerDropdown;
private readonly InputControlPickerState m_PickerState;

Expand Down