Class InputControlLayout
A control layout specifies the composition of an InputControl or InputDevice.
Namespace: UnityEngine.InputSystem.Layouts
Assembly: Unity.InputSystem.dll
Syntax
public class InputControlLayout
Remarks
Control layouts can be created in three possible ways:
- Loaded from JSON.
- Constructed through reflection from InputControls 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 device description using associated device matchers.
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
DefaultVariant
Declaration
public static InternedString DefaultVariant { get; }
Property Value
Type | Description |
---|---|
InternedString |
this[string]
Declaration
public InputControlLayout.ControlItem this[string path] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | path |
Property Value
Type | Description |
---|---|
InputControlLayout.ControlItem |
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 |
---|---|
bool? |
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. |
displayName
Declaration
public string displayName { get; }
Property Value
Type | Description |
---|---|
string |
hideInUI
Declaration
public bool hideInUI { get; }
Property Value
Type | Description |
---|---|
bool |
isControlLayout
Declaration
public bool isControlLayout { get; }
Property Value
Type | Description |
---|---|
bool |
isDeviceLayout
Declaration
public bool isDeviceLayout { get; }
Property Value
Type | Description |
---|---|
bool |
isGenericTypeOfDevice
Declaration
public bool isGenericTypeOfDevice { get; }
Property Value
Type | Description |
---|---|
bool |
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 |
---|---|
bool |
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 |
---|---|
bool | True if the layout acts as an override. |
See Also
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 |
---|---|
int |
type
Declaration
public Type type { get; }
Property Value
Type | Description |
---|---|
Type |
updateBeforeRender
Declaration
public bool updateBeforeRender { get; }
Property Value
Type | Description |
---|---|
bool |
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 |
---|---|
InputControlLayout.ControlItem? |
FindControlIncludingArrayElements(string, out int)
Declaration
public InputControlLayout.ControlItem? FindControlIncludingArrayElements(string path, out int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
string | path | |
int | arrayIndex |
Returns
Type | Description |
---|---|
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 |