using System; using UnityEngine.Scripting; ////REVIEW: should this *not* be inherited? inheritance can lead to surprises namespace UnityEngine.InputSystem.Layouts { /// /// Attribute to control layout settings of a type used to generate an . /// [AttributeUsage(AttributeTargets.Class, Inherited = false)] public sealed class InputControlLayoutAttribute : Attribute { /// /// 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. /// /// 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 . /// public Type stateType { get; set; } public string stateFormat { get; set; } ////TODO: rename this to just "usages"; "commonUsages" is such a weird name [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "According to MSDN, this message can be ignored for attribute parameters, as there are no better alternatives.")] public string[] commonUsages { get; set; } public string variants { get; set; } internal bool? updateBeforeRenderInternal; /// /// Whether the device should receive events in updates. /// /// public bool updateBeforeRender { get => updateBeforeRenderInternal.Value; set => updateBeforeRenderInternal = value; } /// /// If true, the layout describes a generic class of devices such as "gamepads" or "mice". /// /// /// 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 (), for example. /// public bool isGenericTypeOfDevice { get; set; } /// /// Gives a name to display in the UI. By default, the name is the same as the class the attribute /// is applied to. /// public string displayName { get; set; } public string description { get; set; } /// /// If true, don't include the layout when presenting picking options in the UI. /// /// /// This will keep device layouts out of the control picker and will keep control layouts out of /// action type dropdowns. /// public bool hideInUI { get; set; } } }