Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -30,6 +30,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed tooltip support in the UI Toolkit version of the Input Actions Asset editor.
- Fixed documentation to clarify bindings with modifiers `overrideModifiersNeedToBePressedFirst` configuration [ISXB-806](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-806).
- Fixed an issue in `Samples/Visualizers/GamepadVisualizer.unity` sample where the visualization wouldn't handle device disconnects or current device changes properly (ISXB-1243).
- Fixed an issue where action map delegates were not updated when the asset already assigned to the PlayerInput component were changed [ISXB-711](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-711).

### Changed
- Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,8 @@ public TDevice GetDevice<TDevice>()
/// </example>
public void ActivateInput()
{
UpdateDelegates();

m_InputActive = true;

// If we have no current action map but there's a default
Expand All @@ -960,6 +962,31 @@ public void ActivateInput()
m_CurrentActionMap?.Enable();
}

// Users can add and remove actions maps *after* assigning an InputActionAsset to the PlayerInput component.
// This ensures "actionTriggered" delegates are assigned for new maps (case isxb-711)
//
private int m_AllMapsHashCode = 0;
private void UpdateDelegates()
{
if (m_Actions == null)
{
m_AllMapsHashCode = 0;
return;
}

int allMapsHashCode = 0;
foreach (var actionMap in m_Actions.actionMaps)
{
allMapsHashCode ^= actionMap.GetHashCode();
}
if (m_AllMapsHashCode != allMapsHashCode)
{
InstallOnActionTriggeredHook();
CacheMessageNames();
m_AllMapsHashCode = allMapsHashCode;
}
}

/// <summary>
/// Disable input on the player, by disabling the current action map
/// </summary>
Expand Down Expand Up @@ -1515,6 +1542,8 @@ private void CacheMessageNames()

private void ClearCaches()
{
if (m_ActionMessageNames != null)
m_ActionMessageNames.Clear();
}

/// <summary>
Expand Down