docs.unity3d.com
    Show / Hide Table of Contents

    Class InputControlLayout.Builder

    Build a layout programmatically. Primarily for use by layout builders registered with the system.

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

    Properties

    controls

    List of control items set up by the layout.

    Declaration
    public ReadOnlyArray<InputControlLayout.ControlItem> controls { get; }
    Property Value
    Type Description
    ReadOnlyArray<InputControlLayout.ControlItem>

    Controls set up by the layout.

    See Also
    AddControl(String)

    displayName

    Display name to assign to the layout.

    Declaration
    public string displayName { get; set; }
    Property Value
    Type Description
    String

    Display name to assign to the layout

    See Also
    displayName

    extendsLayout

    Which layout to base this layout on.

    Declaration
    public string extendsLayout { get; set; }
    Property Value
    Type Description
    String

    Name of base layout.

    See Also
    baseLayouts

    name

    Name to assign to the layout.

    Declaration
    public string name { get; set; }
    Property Value
    Type Description
    String

    Name to assign to the layout.

    See Also
    name

    stateFormat

    Memory format FourCC code to apply to state memory used by the layout.

    Declaration
    public FourCC stateFormat { get; set; }
    Property Value
    Type Description
    FourCC

    FourCC memory format tag.

    See Also
    stateFormat
    format

    stateSizeInBytes

    Total size of memory used by the layout.

    Declaration
    public int stateSizeInBytes { get; set; }
    Property Value
    Type Description
    Int32

    Size of memory used by the layout.

    See Also
    stateSizeInBytes

    type

    InputControl type to instantiate for the layout.

    Declaration
    public Type type { get; set; }
    Property Value
    Type Description
    Type

    Control type to instantiate for the layout.

    See Also
    type

    updateBeforeRender

    For device layouts, whether the device wants an extra update before rendering.

    Declaration
    public bool? updateBeforeRender { get; set; }
    Property Value
    Type Description
    Nullable<Boolean>

    True if before-render updates should be enabled for the device.

    See Also
    updateBeforeRender
    updateBeforeRender

    Methods

    AddControl(String)

    Add a new control to the layout.

    Declaration
    public InputControlLayout.Builder.ControlBuilder AddControl(string name)
    Parameters
    Type Name Description
    String name

    Name or path of the control. If it is a path (e.g. "leftStick/x", then the control either modifies the setup of a child control of another control in the layout or adds a new child control to another control in the layout. Modifying child control is useful, for example, to alter the state format of controls coming from the base layout. Likewise, adding child controls to another control is useful to modify the setup of of the control layout being used without having to create and register a custom control layout.

    Returns
    Type Description
    InputControlLayout.Builder.ControlBuilder

    A control builder that permits setting various parameters on the control.

    Exceptions
    Type Condition
    ArgumentException

    name is null or empty.

    Build()

    Declaration
    public InputControlLayout Build()
    Returns
    Type Description
    InputControlLayout

    Extend(String)

    Declaration
    public InputControlLayout.Builder Extend(string baseLayoutName)
    Parameters
    Type Name Description
    String baseLayoutName
    Returns
    Type Description
    InputControlLayout.Builder

    WithDisplayName(String)

    Declaration
    public InputControlLayout.Builder WithDisplayName(string displayName)
    Parameters
    Type Name Description
    String displayName
    Returns
    Type Description
    InputControlLayout.Builder

    WithFormat(String)

    Declaration
    public InputControlLayout.Builder WithFormat(string format)
    Parameters
    Type Name Description
    String format
    Returns
    Type Description
    InputControlLayout.Builder

    WithFormat(FourCC)

    Declaration
    public InputControlLayout.Builder WithFormat(FourCC format)
    Parameters
    Type Name Description
    FourCC format
    Returns
    Type Description
    InputControlLayout.Builder

    WithName(String)

    Declaration
    public InputControlLayout.Builder WithName(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    InputControlLayout.Builder

    WithSizeInBytes(Int32)

    Declaration
    public InputControlLayout.Builder WithSizeInBytes(int sizeInBytes)
    Parameters
    Type Name Description
    Int32 sizeInBytes
    Returns
    Type Description
    InputControlLayout.Builder

    WithType<T>()

    Declaration
    public InputControlLayout.Builder WithType<T>()
        where T : InputControl
    Returns
    Type Description
    InputControlLayout.Builder
    Type Parameters
    Name Description
    T

    See Also

    RegisterLayoutBuilder(Func<InputControlLayout>, String, String, Nullable<InputDeviceMatcher>)
    Back to top
    Terms of use
    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