Class InputControlAttribute | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class InputControlAttribute

    Mark a field or property as representing/identifying an input control in some form.

    Inheritance
    System.Object
    InputControlAttribute
    Namespace: UnityEngine.InputSystem.Layouts
    Syntax
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
    public sealed class InputControlAttribute : PropertyAttribute
    Remarks

    This attribute is used in different places for different purposes.

    When creating input control layouts (InputControlLayout) in C#, applying the attribute to fields in a state struct (IInputStateTypeInfo, or GamepadState for an example) or to properties in an input device (InputDevice), will cause an InputControl to be created from the field or property at runtime. The attribute can be applied multiple times to create multiple input controls (e.g. when having an int field that represents a bitfield where each bit is a separate button).

    Another use is for marking string type fields that represent input control paths. Applying the attribute to them will cause them to automatically use when edited in inspectors.

    Finally, the attribute is also used in composite bindings (InputBindingComposite) to mark fields that reference parts of the composite. An example for this is negative.

    Properties

    alias

    Declaration
    public string alias { get; set; }
    Property Value
    Type Description
    System.String

    aliases

    Declaration
    public string[] aliases { get; set; }
    Property Value
    Type Description
    System.String[]

    arraySize

    Declaration
    public int arraySize { get; set; }
    Property Value
    Type Description
    System.Int32

    bit

    Declaration
    public uint bit { get; set; }
    Property Value
    Type Description
    System.UInt32

    defaultState

    Declaration
    public object defaultState { get; set; }
    Property Value
    Type Description
    System.Object

    displayName

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

    format

    Declaration
    public string format { get; set; }
    Property Value
    Type Description
    System.String

    layout

    Declaration
    public string layout { get; set; }
    Property Value
    Type Description
    System.String

    maxValue

    Declaration
    public object maxValue { get; set; }
    Property Value
    Type Description
    System.Object

    minValue

    Declaration
    public object minValue { get; set; }
    Property Value
    Type Description
    System.Object

    name

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

    noisy

    Declaration
    public bool noisy { get; set; }
    Property Value
    Type Description
    System.Boolean

    offset

    Declaration
    public uint offset { get; set; }
    Property Value
    Type Description
    System.UInt32

    parameters

    Declaration
    public string parameters { get; set; }
    Property Value
    Type Description
    System.String

    processors

    Declaration
    public string processors { get; set; }
    Property Value
    Type Description
    System.String

    shortDisplayName

    Declaration
    public string shortDisplayName { get; set; }
    Property Value
    Type Description
    System.String

    sizeInBits

    Declaration
    public uint sizeInBits { get; set; }
    Property Value
    Type Description
    System.UInt32

    synthetic

    Declaration
    public bool synthetic { get; set; }
    Property Value
    Type Description
    System.Boolean

    usage

    Declaration
    public string usage { get; set; }
    Property Value
    Type Description
    System.String

    usages

    Declaration
    public string[] usages { get; set; }
    Property Value
    Type Description
    System.String[]

    useStateFrom

    Declaration
    public string useStateFrom { get; set; }
    Property Value
    Type Description
    System.String

    variants

    Declaration
    public string variants { get; set; }
    Property Value
    Type Description
    System.String

    See Also

    InputControlLayout
    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