Control items
Each layout is comprised of zero or more Control items. Each item either describes a new Control, or modifies the properties of an existing Control. The latter can also reach down into the hierarchy and modify properties of a Control added implicitly as a child by another item.
// Add a dpad Control.
[InputControl(layout = "Dpad")]
// And now modify the properties of the "up" Control that was added by the
// "Dpad" layout above.
[InputControl(name = "dpad/up", displayName = "DPADUP")]
public int buttons;
The following table details the properties that a Control item can have. These can be set as properties on InputControlAttribute, as properties on the Control in JSON, or through methods on InputControlLayout.Builder.ControlBuilder.
| Property | Description |
|---|---|
name |
Name of the Control. By default, this is the name of the field/property that InputControlAttribute is applied to. |
displayName |
Display name of the Control (for use in UI strings). |
shortDisplayName |
Short display name of the Control (for use in UI strings). |
layout |
Layout to use for the Control. |
variants |
Variants of the Control. |
aliases |
Aliases for the Control. These are alternative names the Control can be referred by. |
usages |
Usages of the Control. |
offset |
The byte offset at which the state for the Control is found. |
bit |
The bit offset at which the state of the Control is found within its byte. |
sizeInBits |
The total size of the Control's state, in bits. |
arraySize |
If this is set to a non-zero value, the system will create an array of Controls of this size. |
parameters |
Any parameters to be passed to the Control. The system will apply these to any fields the Control type might have, such as AxisControl.scaleFactor. |
processors |
Processors to apply to the Control. |
noisy |
Whether the Control is to be considered noisy. |
synthetic |
Whether the Control is to be considered synthetic. |
defaultState |
Default initial value of the state memory Control. |
useStateFrom |
For synthetic Controls, used to synthesize Control state. |
minValue |
The minimum value the Control can report. Used for evaluating Control magnitude. |
maxValue |
The maximum value the Control can report. Used for evaluating Control magnitude. |
dontReset |
When a device "soft" reset is performed, the state of this control will not be reset. This is useful for controls such as pointer positions which should not go to (0,0) on a reset. When a "hard" reset is performed, the control will still be reset to its default value. |