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
Control actuation refers to whether or not a [control](controls.md) is currently being used by the user.
8
8
9
-
A control is considered actuated when it has moved away from its default state in such a way that it affects the value of the control.
9
+
A control is considered "actuated" when it has moved away from its default state in such a way that it affects the actual value of the control. Use [`IsActuated`](xref:UnityEngine.InputSystem.InputControlExtensions.IsActuated(UnityEngine.InputSystem.InputControl,System.Single)) to query whether a control is currently actuated.
10
10
11
11
The recommended workflow is to [bind controls to actions](add-duplicate-delete-binding.md), and then [respond to input at runtime](./respond-to-input.md) by polling or recieving callbacks from those actions. For this reason, it is not typically necessary to directly check whether a control is actuated. Instead, actuation of a control bound to an action causes the action to be performed (according to its [interaction pattern](Interactions.md), if an interaction has been assigned).
12
12
@@ -34,7 +34,7 @@ if (Gamepad.current.leftStick.EvaluateMagnitude() > 0.25f)
34
34
Debug.Log("Left Stick actuated past 25%");
35
35
```
36
36
37
-
There are two mechanisms within the Input System that most notably make use of control actuation:
37
+
These two mechanisms use control actuation:
38
38
39
39
-[Interactive rebinding](interactive-rebinding.md) (`InputActionRebindingExceptions.RebindOperation`) uses it to select between multiple suitable controls to find the one that is actuated the most.
40
40
-[Conflict resolution](binding-conflicts.md) between multiple controls that are bound to the same action uses it to decide which control gets to drive the action.
Copy file name to clipboardExpand all lines: Packages/com.unity.inputsystem/Documentation~/control-paths.md
+27-9Lines changed: 27 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,7 @@ uid: input-system-control-paths
4
4
5
5
# Control paths
6
6
7
-
Control paths represent the way to describe a control or group of controls on a device, when [binding](bindings.md) them to an [action](actions.md).
8
-
9
-
An example of a control path is `<Gamepad>/leftStick/x`, which refers to the X-axis of the left stick of any gamepad.
7
+
The Input System can look up controls using textual paths. [Bindings](bindings.md) on Input [Actions](actions.md) rely on this feature to identify the control(s) they read input from. For example, `<Gamepad>/leftStick/x` means "X control on left stick of gamepad". However, you can also use them for lookup directly on controls and devices, or to let the Input System search for controls among all devices using [`InputSystem.FindControls`](xref:UnityEngine.InputSystem.InputSystem.FindControls(System.String)):
10
8
11
9
At runtime, the Input System performs a look-up of all control paths against the currently connected devices to discover which controls match the ones specified in the paths. This process is called [binding resolution](binding-resolution.md).
12
10
@@ -36,13 +34,17 @@ The device and control tree is organized hierarchically from generic to specific
36
34
37
35
## Format
38
36
39
-
Control paths are strings, which resemble file system paths. Each path consists of one or more components separated by a forward slash:
37
+
Control paths resemble file system paths: they contain components separated by a forward slash (`/`):
40
38
41
-
component/component...
39
+
```
40
+
component/component...
41
+
```
42
42
43
-
Each component uses a similar syntax made up of multiple fields. Each field is optional, but at least one field must be present. All fields are case-insensitive.
43
+
Each component itself contains a set of fields with its own syntax. Each field is individually optional, provided that at least one of the fields is present as either a name or a wildcard:
44
44
45
-
<layoutName>{usageName}controlName#(displayName)
45
+
```structured text
46
+
<layoutName>{usageName}#(displayName)controlName
47
+
```
46
48
47
49
The following table explains the use of each field:
48
50
@@ -53,16 +55,32 @@ The following table explains the use of each field:
53
55
|`controlName`|Requires the control at the current level to have the given name. Takes both "proper" names ([`InputControl.name`](xref:UnityEngine.InputSystem.InputControl)) and aliases ([`InputControl.aliases`](xref:UnityEngine.InputSystem.InputControl)) into account.<br><br>This field can also be a wildcard (`*`) to match any name.|`MyGamepad/buttonSouth`<br><br>`*/{PrimaryAction}` (match `PrimaryAction` usage on Devices with any name)|
54
56
|`#(displayName)`|Requires the control at the current level to have the given display name (i.e. [`InputControl.displayName`](xref:UnityEngine.InputSystem.InputControl)). The display name may contain whitespace and symbols.|`<Keyboard>/#(a)` (matches the key that generates the "a" character, if any, according to the current keyboard layout).<br><br>`<Gamepad>/#(Cross)`|
55
57
58
+
Here are examples of control paths:
59
+
60
+
```csharp
61
+
// Matches all gamepads (also gamepads *based* on the Gamepad layout):
62
+
"<Gamepad>"
63
+
// Matches the "Submit" control on all devices:
64
+
"*/"
65
+
// Matches the key that prints the "a" character on the current keyboard layout:
66
+
"<Keyboard>/#(a)"
67
+
// Matches the X axis of the left stick on a gamepad.
68
+
"<Gamepad>/leftStick/x"
69
+
// Matches the orientation control of the right-hand XR controller:
70
+
"<XRController>/orientation"
71
+
// Matches all buttons on a gamepad.
72
+
"<Gamepad>/<Button>"
73
+
```
74
+
56
75
### Wildcard characters
57
76
58
77
If you enter a control path as text, you can use the wildcard asterisk character (`*`) to match multiple controls in the hierarchy specified. For example, you can use `<Touchscreen>/touch*/press` to bind to any finger pressed on the touchscreen, instead of individually binding to `<Touchscreen>/touch0/press`, `<Touchscreen>/touch1/press` and each other numbered touch separately.
59
78
60
79
61
80
## Access from code
62
81
63
-
You can access the literal path of a given control via its [`InputControl.path`](xref:UnityEngine.InputSystem.InputControl) property.
82
+
You can access the literal path of a given control via its [`InputControl.path`](xref:UnityEngine.InputSystem.InputControl.path) property. If you need to, you can manually parse a control path into its components using the [`InputControlPath.Parse(path)`](xref:UnityEngine.InputSystem.InputControlPath.Parse(System.String)) API:
64
83
65
-
If needed, you can manually parse a control path into its components using the [`InputControlPath.Parse(path)`](xref:UnityEngine.InputSystem.InputControlPath) API.
Copy file name to clipboardExpand all lines: Packages/com.unity.inputsystem/Documentation~/control-state.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ However, the documentation on this page gives information about the details of h
14
14
15
15
Each control is connected to a block of memory that is considered the control's "state". You can query the size, format, and location of this block of memory from a control through the [`InputControl.stateBlock`](xref:UnityEngine.InputSystem.InputControl) property.
16
16
17
-
The state of controls is stored in unmanaged memory that the Input System handles internally. All Devices added to the system share one block of unmanaged memory that contains the state of all the controls on the Devices.
17
+
The Input System stores the state of controls in unmanaged memory that it handles internally. All Devices added to the system share one block of unmanaged memory that contains the state of all the controls on the Devices.
18
18
19
19
A control's state might not be stored in the natural format for that control. For example, the system often represents buttons as bitfields, and axis controls as 8-bit or 16-bit integer values. This format is determined by the combination of platform, hardware, and drivers. Each control knows the format of its storage and how to translate the values as needed. The Input System uses [layouts](layouts.md) to understand this representation.
Copy file name to clipboardExpand all lines: Packages/com.unity.inputsystem/Documentation~/create-edit-delete-actions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ However there are many other ways to work with actions which might suit less com
9
9
10
10
## Create Actions using the Action editor
11
11
12
-
For information on how to create and edit Input Actions in the editor, see the [Input Actions editor](actions-editor.md). This is the recommended workflow if you want to organise all your input actions and bindings in one place, which applies across the whole of your project. This often the case for most types of game or app.
12
+
For information on how to create and edit Input Actions in the editor, see the [Input Actions editor](actions-editor.md). This is the recommended workflow if you want to organize all your input actions and bindings in one place, which applies across the whole of your project. This often the case for most types of game or app.
Copy file name to clipboardExpand all lines: Packages/com.unity.inputsystem/Documentation~/noisy-controls.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,12 @@ If a control is marked as noisy:
17
17
- When the application loses focus and Devices are [reset](reset-device.md) as a result, the state of noisy control will be preserved as is. This ensures that sensor readings will remain at their last value rather than being reset to default values.
18
18
19
19
> [!NOTE]
20
+
> To query whether a control is noisy, use the [`InputControl.noisy`](xref:UnityEngine.InputSystem.InputControl.noisy) property.
21
+
>
20
22
> If any control on a device is noisy, the device itself is flagged as noisy.
21
23
22
24
In addition to the [`input state`](xref:UnityEngine.InputSystem.InputControl) and the [`default state`](xref:UnityEngine.InputSystem.InputControl) that the Input System keeps for all Devices currently present, it also maintains a [`noise mask`](xref:UnityEngine.InputSystem.InputControl) in which only bits for state that is __not__ noise are set. You can use this to efficiently mask out noise in input.
25
+
26
+
### Noise masks
27
+
28
+
Parallel to the [`input state`](xref:UnityEngine.InputSystem.InputControl.currentStatePtr) and the [`default state`](xref:UnityEngine.InputSystem.InputControl.defaultStatePtr) that the Input System keeps for all devices currently present, it also maintains a [`noise mask`](xref:UnityEngine.InputSystem.InputControl.noiseMaskPtr) in which only bits for state that is __not__ noise are set. This can be used to very efficiently mask out noise in input.
0 commit comments