@@ -2083,6 +2083,23 @@ public RebindingOperation OnMatchWaitForAnother(float seconds)
20832083 return this ;
20842084 }
20852085
2086+ /// <summary>
2087+ /// Ensures state changes are allowed to propagate during rebinding but suppresses action updates.
2088+ /// The default behavior is that state changes are also suppressed during rebinding.
2089+ /// </summary>
2090+ /// <remarks>
2091+ /// This is achieved by temporarily setting <see cref="InputSystem.inputEventHandledPolicy"/> to
2092+ /// <see cref="InputEventHandledPolicy.SuppressActionUpdates" />. This is automatically reverted when
2093+ /// the rebinding operation completes. If the policy is already set to
2094+ /// <see cref="InputEventHandledPolicy.SuppressActionUpdates" />, this method has no effect.
2095+ /// </remarks>
2096+ /// <returns>Reference to this rebinding operation.</returns>
2097+ public RebindingOperation WithSuppressedActionPropagation ( )
2098+ {
2099+ m_TargetInputEventHandledPolicy = InputEventHandledPolicy . SuppressActionUpdates ;
2100+ return this ;
2101+ }
2102+
20862103 /// <summary>
20872104 /// Start the rebinding. This should be invoked after the rebind operation has been fully configured.
20882105 /// </summary>
@@ -2107,6 +2124,9 @@ public RebindingOperation Start()
21072124
21082125 m_StartTime = InputState . currentTime ;
21092126
2127+ m_SavedInputEventHandledPolicy = InputSystem . inputEventHandledPolicy ;
2128+ InputSystem . inputEventHandledPolicy = m_TargetInputEventHandledPolicy ;
2129+
21102130 if ( m_WaitSecondsAfterMatch > 0 || m_Timeout > 0 )
21112131 {
21122132 HookOnAfterUpdate ( ) ;
@@ -2606,6 +2626,8 @@ private void ResetAfterMatchCompleted()
26062626
26072627 UnhookOnEvent ( ) ;
26082628 UnhookOnAfterUpdate ( ) ;
2629+
2630+ InputSystem . inputEventHandledPolicy = m_SavedInputEventHandledPolicy ;
26092631 }
26102632
26112633 private void ThrowIfRebindInProgress ( )
@@ -2654,6 +2676,8 @@ private string GeneratePathForControl(InputControl control)
26542676 private double m_StartTime ;
26552677 private float m_Timeout ;
26562678 private float m_WaitSecondsAfterMatch ;
2679+ private InputEventHandledPolicy m_SavedInputEventHandledPolicy ;
2680+ private InputEventHandledPolicy m_TargetInputEventHandledPolicy ;
26572681 private InputControlList < InputControl > m_Candidates ;
26582682 private Action < RebindingOperation > m_OnComplete ;
26592683 private Action < RebindingOperation > m_OnCancel ;
0 commit comments