You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can override aspects of any Binding at run-time non-destructively. Specific properties of [`InputBinding`](../api/UnityEngine.InputSystem.InputBinding.html) have an `override` variant that, if set, will take precedent over the property that they shadow. All `override` properties are of type `String`.
5
-
6
-
|Property|Override|Description|
7
-
|--------|--------|-----------|
8
-
|[`path`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_path)|[`overridePath`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_overridePath)|Replaces the [Control path](./Controls.md#control-paths) that determines which Control(s) are referenced in the binding. If [`overridePath`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_overridePath) is set to an empty string, the binding is effectively disabled.<br><br>Example: `"<Gamepad>/leftStick"`|
9
-
|[`processors`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_processors)|[`overrideProcessors`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_overrideProcessors)|Replaces the [processors](./Processors.md) applied to the binding.<br><br>Example: `"invert,normalize(min=0,max=10)"`|
10
-
|[`interactions`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_interactions)|[`overrideInteractions`](../api/UnityEngine.InputSystem.InputBinding.html#UnityEngine_InputSystem_InputBinding_overrideInteractions)|Replaces the [interactions](./Interactions.md) applied to the binding.<br><br>Example: `"tap(duration=0.5)"`|
11
-
12
-
>NOTE: The `override` property values will not be saved along with the Actions (for example, when calling [`InputActionAsset.ToJson()`](../api/UnityEngine.InputSystem.InputActionAsset.html#UnityEngine_InputSystem_InputActionAsset_ToJson)). See [Saving and loading rebinds](#saving-and-loading-rebinds) for details about how to persist user rebinds.
13
-
14
-
To set the various `override` properties, you can use the [`ApplyBindingOverride`](../api/UnityEngine.InputSystem.InputActionRebindingExtensions.html#UnityEngine_InputSystem_InputActionRebindingExtensions_ApplyBindingOverride_UnityEngine_InputSystem_InputAction_UnityEngine_InputSystem_InputBinding_) APIs.
15
-
16
-
```CSharp
17
-
// Rebind the "fire" action to the left trigger on the gamepad.
In most cases, it is best to locate specific bindings using APIs such as [`GetBindingIndexForControl`](../api/UnityEngine.InputSystem.InputActionRebindingExtensions.html#UnityEngine_InputSystem_InputActionRebindingExtensions_GetBindingIndexForControl_) and to then apply the override to that specific binding.
Copy file name to clipboardExpand all lines: Packages/com.unity.inputsystem/Documentation~/binding-conflicts.md
+21-17Lines changed: 21 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,34 @@
1
1
2
2
# Binding conflicts
3
3
4
-
A binding conflict is when an [action](./actions.md) with more than one [control](./controls.md)[bound](./bindings.md) to it recieves values from multiple controls.
4
+
A binding conflict is when an [action](./actions.md) with more than one [control](./controls.md)[bound](./bindings.md) to it recieves values from multiple controls.
5
5
6
-
For example, if the left and right triggers of a gamepad are both bound to an "accelerate" action in your game, each trigger could be pressed in to different amounts. This conflict of recieving two different values for the same action is resolved by the Input System.
6
+
## Conflict situations
7
7
8
-
## Conflict Resolution
8
+
Binding conflict situations can arise in two different ways. Either:
9
+
10
+
-**Multiple concurrent controls**. Several controls are bound to the same action and more than one is feeding input into the Action at the same time. Example: an Action that is bound to both the left and right trigger on a Gamepad and both triggers are pressed.
9
11
10
-
For [value type actions](./action-and-control-types.md), the Input System continuously monitors all the controls bound to the action, and then chooses the one which is the **most actuated** to be the control driving the action. Most actuated means the largest absolute value is being reported, whether positive or negative in the case of a 1D axis, and regardless of direction in the case of 2D and 3D axes. The value of the most actuated control is reported in callbacks, and triggered whenever the value changes.
12
+
Or:
11
13
12
-
If a different bound control is actuated more, that control becomes the control driving the action. This process is called **conflict resolution**. This is useful if you want to allow different Controls to control an Action in the game, but only take input from one Control at the same time.
14
+
-**Multiple input sequences**. The input is part of a sequence of inputs and there are several possible such sequences. Example: one Action is bound to the `B` key and another Action is bound to `Shift-B`.
13
15
14
-
## Ambiguous situations
16
+
## Conflict Resolution
15
17
16
-
There are two situations where a given input might lead to ambiguity:
18
+
For [**value** and **button** type actions](./action-and-control-types.md), the Input System continuously monitors all the controls bound to the action, and then chooses the one which is the **most actuated** to be the control driving the action. Most actuated means the largest absolute value is being reported, whether positive or negative in the case of a 1D axis, and regardless of direction in the case of 2D and 3D axes. The value of the most actuated control is reported in callbacks, and triggered whenever the value changes.
17
19
18
-
1. Several controls are bound to the same action and more than one is feeding input into the Action at the same time. Example: an Action that is bound to both the left and right trigger on a Gamepad and both triggers are pressed.
19
-
2. The input is part of a sequence of inputs and there are several possible such sequences. Example: one Action is bound to the `B` key and another Action is bound to `Shift-B`.
20
+
If a different bound control is actuated more, that control becomes the control driving the action. This is useful if you want to allow different Controls to control an Action in the game, but only take input from one Control at the same time.
20
21
21
-
## Multiple concurrently used controls
22
+
[Pass-through type actions](./configure-action-type.md) do not perform conflict resolution, and are intended allow multiple concurrent inputs.
22
23
23
-
>__Note:__ This section does not apply to [pass-through](./configure-action-type.md) actions, which do not perform conflict resolution, and are intended allow multiple concurrent inputs.
24
+
## Multiple concurrent controls
24
25
25
26
For a **Button** or **Value**[action type](./configure-action-type.md), there can only be one control at any time that is "driving" the action. This control is considered the [`activeControl`](../api/UnityEngine.InputSystem.InputAction.html#UnityEngine_InputSystem_InputAction_activeControl).
26
27
27
28
When an action is bound to multiple controls, the active control at any point is the one with the greatest level of ["actuation"](./control-actuation.md) (the one with the largest value returned from [`EvaluateMagnitude`](../api/UnityEngine.InputSystem.InputControl.html#UnityEngine_InputSystem_InputControl_EvaluateMagnitude_)). If a different control exceeds the actuation level of the current active control, it becomes the active control.
28
29
29
30
For [composite bindings](./composite-bindings.md), magnitudes of the composite as a whole rather than for individual controls are tracked. However, [`activeControl`](../api/UnityEngine.InputSystem.InputAction.html#UnityEngine_InputSystem_InputAction_activeControl) will still track individual Controls from the composite.
30
31
31
-
## Disabling Conflict Resolution
32
-
33
-
Conflict resolution is always applied to **Button** or **Value**[action types](./configure-action-type.md). However, it can be undesirable in situations when an action is simply used to gather all inputs from bound Controls. For example, if you have a **Button** type action bound to the **A** button on all gamepads, a user holding down **A** on one gamepad means that the **A** button on other gamepads is ignored.
34
-
35
-
By using the **Pass Through** action type, conflict resolution is bypassed, which means pressing the **A** button on one gamepad will not result in presses on other gamepads being ignored.
36
-
37
32
## Multiple input sequences (such as keyboard shortcuts)
38
33
39
34
>__Note__: The mechanism described here only applies to Actions that are part of the same [action map](./action-maps-panel.md) or [action assets](./action-assets.md).
@@ -49,6 +44,15 @@ In our example, this means that a **one-modifier composite** binding to **Shift*
49
44
50
45
Additionally, the first Binding that results in the Action changing [phase](./set-callbacks-on-actions.md) will consume the input. This results in other Bindings to the same input not being processed. This means in our example, when the **Shift** + **B** binding consumes the **B** input, the Binding to **B** is skipped.
51
46
47
+
48
+
## Disabling Conflict Resolution
49
+
50
+
Conflict resolution is always applied to **Button** or **Value**[action types](./configure-action-type.md). However, it can be undesirable in situations when an action is simply used to gather all inputs from bound Controls. For example, if you have a **Button** type action bound to the **A** button on all gamepads, a user holding down **A** on one gamepad means that the **A** button on other gamepads is ignored.
51
+
52
+
By using the **Pass Through** action type, conflict resolution is bypassed, which means pressing the **A** button on one gamepad will not result in presses on other gamepads being ignored.
53
+
54
+
## API Example
55
+
52
56
The following example illustrates how this works at the API level.
A **binding** represents a connection between an [Action](actions.md) and one or more [Controls](Controls.md) identified by a [Control path](./control-paths.md).
|**[Initial state checks](binding-initial-state-checks.md)**| Summary |
9
+
|**[Introduction to Bindings](introduction-to-bindings.md)**| Learn the basic concepts of bindings. |
10
+
|**[Add, Duplicate or Delete a Binding](add-duplicate-delete-binding.md)**| Learn how to add, duplicate or delete bindings. |
11
+
|**[Pick a control for Binding](pick-control-binding.md)**| Learn how to choose a specific control that a binding is bound to, such as a specific button or stick on a gamepad, or a specific keyboard key. |
12
+
|**[Composite Bindings](composite-bindings.md)**| Bindings made up of multiple simple bindings acting together. |
13
+
|**[Group bindings to control schemes](group-binding-to-control-scheme.md)**| Group types of related bindings together according to their control type, so that you can enable or disable groups of bindings |
14
+
|**[Binding resolution](binding-resolution.md)**| Learn how the Input Systems resolves binding configurations to currently-connected input devices. |
15
+
|**[Restrict bindings to specific devices](restrict-bindings-specific-device.md)**| Specify which specific devices a binding should resolve to. |
16
+
|**[Binding conflicts](binding-conflicts.md)**| Learn how the Input System resolves conflicting or ambiguous situations, such as when multiple bindings map to the same action. |
17
+
|**[Initial state checks](binding-initial-state-checks.md)**| Learn how the Input System deals with if a control is already pressed when an action is enabled, and how to modify this behavior. |
0 commit comments