docs.unity3d.com
Search Results for

    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
    Assembly: Unity.InputSystem.dll
    Syntax
    public class InputControlLayout
    Remarks

    Control layouts can be created in three possible ways:

    1. Loaded from JSON.
    2. Constructed through reflection from InputControls 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 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
    canRunInBackground
    backgroundBehavior

    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
    isNoisy

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

    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
    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

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Fields
      • VariantSeparator
    • Properties
      • DefaultVariant
      • this[string]
      • appliedOverrides
      • baseLayouts
      • canRunInBackground
      • commonUsages
      • controls
      • displayName
      • hideInUI
      • isControlLayout
      • isDeviceLayout
      • isGenericTypeOfDevice
      • isNoisy
      • isOverride
      • name
      • stateFormat
      • stateSizeInBytes
      • type
      • updateBeforeRender
      • variants
    • Methods
      • FindControl(InternedString)
      • FindControlIncludingArrayElements(string, out int)
      • FromJson(string)
      • FromType(string, Type)
      • GetValueType()
      • MergeLayout(InputControlLayout)
      • ToJson()
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)