Class InputControlLayout | Input System | 1.0.2
docs.unity3d.com
    Show / Hide Table of Contents

    Class InputControlLayout

    A control layout specifies the composition of an InputControl or InputDevice.

    Inheritance
    Object
    InputControlLayout
    Namespace: UnityEngine.InputSystem.Layouts
    Syntax
    public class InputControlLayout
    Remarks

    Control layouts can be created in three possible ways:

    1. Loaded from JSON.
    2. Constructed through reflection from InputControl classes.
    3. 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>

    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.

    Remarks

    Note that this list TODO

    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

    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
    RegisterLayoutOverride(String, String)

    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
    valueType

    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
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023