Skip to content

Commit 512f0c0

Browse files
authored
InputProvider correctly tracks enabled state of actions (#418)
1 parent 2961b71 commit 512f0c0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111
- Bugfix: EmbeddedAssetProperties were not displayed correctly in the editor.
1212
- Timeline guards added to scripts that rely on it.
1313
- Bugfix: SaveDuringPlay works with ILists now.
14+
- Bugfix: CinemachineInputProvider now correctly tracks enabled state of input action
15+
1416

1517
## [2.9.0-pre.6] - 2022-01-12
1618
- Bugfix: Negative Near Clip Plane value is kept when camera is orthographic.

Runtime/Helpers/CinemachineInputProvider.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ protected InputAction ResolveForPlayer(int axis, InputActionReference actionRef)
9090
m_cachedActions[axis] = GetFirstMatch(InputUser.all[PlayerIndex], actionRef);
9191
}
9292
}
93-
// Auto-enable it if disabled
94-
if (m_cachedActions[axis] != null && !m_cachedActions[axis].enabled)
95-
m_cachedActions[axis].Enable();
93+
// Update enabled status
94+
if (m_cachedActions[axis] != null && m_cachedActions[axis].enabled != actionRef.action.enabled)
95+
{
96+
if (actionRef.action.enabled)
97+
m_cachedActions[axis].Enable();
98+
else
99+
m_cachedActions[axis].Disable();
100+
}
96101

97102
return m_cachedActions[axis];
98103

0 commit comments

Comments
 (0)