docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class InputControlLayoutAttribute

    Attribute to control layout settings of a type used to generate an InputControlLayout.

    Inheritance
    object
    Attribute
    InputControlLayoutAttribute
    Inherited Members
    Attribute.Equals(object)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetHashCode()
    Attribute.IsDefaultAttribute()
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.Match(object)
    Attribute.TypeId
    Namespace: UnityEngine.InputSystem.Layouts
    Assembly: Unity.InputSystem.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class, Inherited = false)]
    public sealed class InputControlLayoutAttribute : Attribute

    Properties

    canRunInBackground

    Declaration
    public bool canRunInBackground { get; set; }
    Property Value
    Type Description
    bool

    commonUsages

    Declaration
    public string[] commonUsages { get; set; }
    Property Value
    Type Description
    string[]

    description

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

    displayName

    Gives a name to display in the UI. By default, the name is the same as the class the attribute is applied to.

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

    hideInUI

    If true, don't include the layout when presenting picking options in the UI.

    Declaration
    public bool hideInUI { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    This will keep device layouts out of the control picker and will keep control layouts out of action type dropdowns.

    isGenericTypeOfDevice

    If true, the layout describes a generic class of devices such as "gamepads" or "mice".

    Declaration
    public bool isGenericTypeOfDevice { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    This property also determines how the layout is presented in the UI. All the device layouts that are marked as generic kinds of devices are displayed with their own entry at the root level of the control picker (InputControlPicker), for example.

    isNoisy

    Allows marking a device as noisy regardless of control layout.

    Declaration
    public bool isNoisy { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Controls can be individually marked as noisy using the noisy attribute, but this property can be used to mark a device as noisy even when no control has been marked as such. This can be useful when a device state layout has only been partially implemented i.e. some data in the state memory has not been mapped to a control, and the unimplemented controls are noisy. Without doing this, the device will constantly be made current as the system has no way to know that the event data contains only noise.

    stateFormat

    FourCC identifier for the memory format associated with the layout.

    Declaration
    public string stateFormat { get; set; }
    Property Value
    Type Description
    string
    See Also
    format

    stateType

    Associates a state representation with an input device and drives the control layout generated for the device from its state rather than from the device class.

    Declaration
    public Type stateType { get; set; }
    Property Value
    Type Description
    Type
    Remarks

    This is only useful if you have a state struct dictating a specific state layout and you want the device layout to automatically take offsets from the fields annotated with InputControlAttribute.

     <example>
     <pre><code class="lang-csharp">public struct MyStateStruct : IInputStateTypeInfo
     {
         public FourCC format => new FourCC('M', 'Y', 'D', 'V');
    
         [InputControl(name = "button1", layout = "Button", bit = 0)]
         [InputControl(name = "button2", layout = "Button", bit = 0)]
         public int buttons;
     }
    
     [InputControlLayout(stateType = typeof(MyStateStruct)]
     public class MyDevice : InputDevice
     {
     }</code></pre>
     </example>
    
    See Also
    InputStateBlock
    MouseState

    updateBeforeRender

    Whether the device should receive events in BeforeRender updates.

    Declaration
    public bool updateBeforeRender { get; set; }
    Property Value
    Type Description
    bool
    See Also
    updateBeforeRender

    variants

    Declaration
    public string variants { get; set; }
    Property Value
    Type Description
    string
    In This Article
    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)