@@ -256,23 +256,22 @@ public void ResetToDefault()
256
256
/// <remarks>It is expected that the other control is of a compatible type.</remarks>
257
257
/// <param name="other">The other instance to swap binding with.</param>
258
258
/// <returns>true if successfully swapped, else false.</returns>
259
- public void Swap ( RebindActionUI other )
259
+ public void SwapBinding ( RebindActionUI other )
260
260
{
261
261
if ( this == other )
262
262
return ; // Silently ignore any request to swap binding with itself
263
263
if ( ongoingRebind != null || other . ongoingRebind != null )
264
- return ; // Do not allow swapping with ongoing rebinding .
265
-
264
+ throw new Exception ( "Cannot swap bindings when interactive rebinding is ongoing" ) ;
266
265
if ( ! ResolveActionAndBinding ( out var action , out var bindingIndex ) )
267
266
throw new Exception ( "Failed to resolve action and binding index" ) ;
268
267
if ( ! other . ResolveActionAndBinding ( out var otherAction , out var otherBindingIndex ) )
269
268
throw new Exception ( "Failed to resolve action and binding index" ) ;
270
269
271
- // Apply binding override to target binding
272
- var path = action . bindings [ bindingIndex ] . path ;
273
- var otherPath = otherAction . bindings [ otherBindingIndex ] . path ;
274
- action . ApplyBindingOverride ( bindingIndex , otherPath ) ;
275
- otherAction . ApplyBindingOverride ( otherBindingIndex , path ) ;
270
+ // Apply binding override to target binding based on swapped effective binding paths.
271
+ var effectivePath = action . bindings [ bindingIndex ] . effectivePath ;
272
+ var otherEffectivePath = otherAction . bindings [ otherBindingIndex ] . effectivePath ;
273
+ action . ApplyBindingOverride ( bindingIndex , otherEffectivePath ) ;
274
+ otherAction . ApplyBindingOverride ( otherBindingIndex , effectivePath ) ;
276
275
}
277
276
278
277
/// <summary>
0 commit comments