Class InputControlLayout
A control layout specifies the composition of an InputControl or InputDevice.
Namespace: UnityEngine.InputSystem.Layouts
Syntax
public class InputControlLayout
Remarks
Control layouts can be created in three possible ways:
- Loaded from JSON.
- Constructed through reflection from InputControl classes.
- Through layout factories using InputControlLayout.Builder.
Once constructed, control layouts are immutable (but you can always replace a registered layout in the system and it will affect everything constructed from the layout).
Control layouts can be for arbitrary control rigs or for entire devices. Device layouts can be matched to InputDeviceDescription using associated InputDeviceMatcher.
InputControlLayout objects are considered temporaries. Except in the editor, they are not kept around beyond device creation.
See the manual for more details on control layouts.
Fields
VariantSeparator
Declaration
public const string VariantSeparator = ";"
Field Value
| Type | Description |
|---|---|
| String |
Properties
appliedOverrides
Declaration
public IEnumerable<InternedString> appliedOverrides { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<InternedString> |
baseLayouts
Declaration
public IEnumerable<InternedString> baseLayouts { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<InternedString> |
canRunInBackground
Override value for canRunInBackground. If this is set by the layout, it will prevent QueryCanRunInBackground from being issued. However, other logic that affects canRunInBackground may still force a specific value on a device regardless of what's set in the layout.
Declaration
public bool? canRunInBackground { get; }
Property Value
| Type | Description |
|---|---|
| Nullable<Boolean> |
See Also
commonUsages
Declaration
public ReadOnlyArray<InternedString> commonUsages { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyArray<InternedString> |
controls
List of child controls defined for the layout.
Declaration
public ReadOnlyArray<InputControlLayout.ControlItem> controls { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyArray<InputControlLayout.ControlItem> | Child controls defined for the layout. |
DefaultVariant
Declaration
public static InternedString DefaultVariant { get; }
Property Value
| Type | Description |
|---|---|
| InternedString |
displayName
Declaration
public string displayName { get; }
Property Value
| Type | Description |
|---|---|
| String |
hideInUI
Declaration
public bool hideInUI { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isControlLayout
Declaration
public bool isControlLayout { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isDeviceLayout
Declaration
public bool isDeviceLayout { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isGenericTypeOfDevice
Declaration
public bool isGenericTypeOfDevice { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
isNoisy
Mark the input device created from this layout as noisy, irrespective of whether or not any of its controls have been marked as noisy.
Declaration
public bool isNoisy { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
See Also
isOverride
Whether the layout is applies overrides to other layouts instead of defining a layout by itself.
Declaration
public bool isOverride { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | True if the layout acts as an override. |
See Also
Item[String]
Declaration
public InputControlLayout.ControlItem this[string path] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | path |
Property Value
| Type | Description |
|---|---|
| InputControlLayout.ControlItem |
name
Declaration
public InternedString name { get; }
Property Value
| Type | Description |
|---|---|
| InternedString |
stateFormat
Declaration
public FourCC stateFormat { get; }
Property Value
| Type | Description |
|---|---|
| FourCC |
stateSizeInBytes
Declaration
public int stateSizeInBytes { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
type
Declaration
public Type type { get; }
Property Value
| Type | Description |
|---|---|
| Type |
updateBeforeRender
Declaration
public bool updateBeforeRender { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
variants
Declaration
public InternedString variants { get; }
Property Value
| Type | Description |
|---|---|
| InternedString |
Methods
FindControl(InternedString)
Declaration
public InputControlLayout.ControlItem? FindControl(InternedString path)
Parameters
| Type | Name | Description |
|---|---|---|
| InternedString | path |
Returns
| Type | Description |
|---|---|
| Nullable<InputControlLayout.ControlItem> |
FindControlIncludingArrayElements(String, out Int32)
Declaration
public InputControlLayout.ControlItem? FindControlIncludingArrayElements(string path, out int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| String | path | |
| Int32 | arrayIndex |
Returns
| Type | Description |
|---|---|
| Nullable<InputControlLayout.ControlItem> |
FromJson(String)
Declaration
public static InputControlLayout FromJson(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| String | json |
Returns
| Type | Description |
|---|---|
| InputControlLayout |
FromType(String, Type)
Declaration
public static InputControlLayout FromType(string name, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | |
| Type | type |
Returns
| Type | Description |
|---|---|
| InputControlLayout |
GetValueType()
Return the type of values produced by controls created from the layout.
Declaration
public Type GetValueType()
Returns
| Type | Description |
|---|---|
| Type | The value type of the control or null if it cannot be determined. |
Remarks
This method only returns the statically inferred value type. This type corresponds to the type argument to InputControl<TValue> in the inheritance hierarchy of type. As the type used by the layout may not inherit from InputControl<TValue>, this may mean that the value type cannot be inferred and the method will return null.
See Also
MergeLayout(InputControlLayout)
Merge the settings from other into the layout such that they become
the base settings.
Declaration
public void MergeLayout(InputControlLayout other)
Parameters
| Type | Name | Description |
|---|---|---|
| InputControlLayout | other |
Remarks
This is the central method for allowing layouts to 'inherit' settings from their
base layout. It will merge the information in other into the current
layout such that the existing settings in the current layout acts as if applied on top
of the settings in the base layout.
ToJson()
Declaration
public string ToJson()
Returns
| Type | Description |
|---|---|
| String |