Struct InputControlScheme | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Struct InputControlScheme

    A named set of zero or more device requirements along an associated binding group.

    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    Namespace: UnityEngine.Experimental.Input
    Syntax
    public struct InputControlScheme : IEquatable<InputControlScheme>
    Remarks

    Control schemes provide an additional layer on top of binding groups. While binding groups allow differentiating sets of bindings (e.g. a "Keyboard&Mouse" group versus a "Gamepad" group), control schemes impose a set of devices requirements that must be met in order for a specific set of bindings to be usable.

    Constructors

    InputControlScheme(String, String, IEnumerable<InputControlScheme.DeviceRequirement>)

    Declaration
    public InputControlScheme(string name, string basedOn = null, IEnumerable<InputControlScheme.DeviceRequirement> devices = null)
    Parameters
    Type Name Description
    System.String name
    System.String basedOn
    IEnumerable<InputControlScheme.DeviceRequirement> devices

    Properties

    baseScheme

    Name of control scheme that this scheme is based on.

    Declaration
    public string baseScheme { get; }
    Property Value
    Type Description
    System.String
    Remarks

    When the control scheme is enabled, all bindings from the base control scheme will also be enabled. At the same time, bindings act as overrides on bindings coming through from the base scheme.

    bindingGroup

    Binding group that is associated with the control scheme.

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

    All bindings in this group as well as in groups inherited from base control schemes are considered to be part of the control scheme.

    deviceRequirements

    Devices used by the control scheme.

    Declaration
    public ReadOnlyArray<InputControlScheme.DeviceRequirement> deviceRequirements { get; }
    Property Value
    Type Description
    ReadOnlyArray<InputControlScheme.DeviceRequirement>
    Remarks

    No two entries will be allowed to match the same control or device at runtime in order for the requirements of the control scheme to be considered satisfied. If, for example, one entry requires a "<Gamepad>" and another entry requires a "<Gamepad>", then at runtime two gamepads will be required even though a single one will match both requirements individually. However, if, for example, one entry requires "<Gamepad>/leftStick" and another requires "<Gamepad>, the same device can match both requirements as each one resolves to a different control.

    name

    Name of the control scheme.

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

    May be empty or null except if the control scheme is part of an InputActionAsset.

    See Also
    AddControlScheme(InputControlScheme)

    Methods

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.ValueType.Equals(System.Object)

    Equals(InputControlScheme)

    Declaration
    public bool Equals(InputControlScheme other)
    Parameters
    Type Name Description
    InputControlScheme other
    Returns
    Type Description
    System.Boolean

    FindControlSchemeForControl<TList>(InputDevice, TList)

    Declaration
    public static InputControlScheme? FindControlSchemeForControl<TList>(InputDevice control, TList schemes)where TList : IEnumerable<InputControlScheme>
    Parameters
    Type Name Description
    InputDevice control
    TList schemes
    Returns
    Type Description
    System.Nullable<InputControlScheme>
    Type Parameters
    Name Description
    TList

    FromJson(String)

    Declaration
    public static InputControlScheme FromJson(string json)
    Parameters
    Type Name Description
    System.String json
    Returns
    Type Description
    InputControlScheme

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.ValueType.GetHashCode()

    PickDevicesFrom<TDevices>(TDevices)

    Based on a list of devices, make a selection that matches the deviceRequirements imposed by the control scheme.

    Declaration
    public InputControlScheme.MatchResult PickDevicesFrom<TDevices>(TDevices devices)where TDevices : IReadOnlyList<InputDevice>
    Parameters
    Type Name Description
    TDevices devices

    A list of devices to choose from.

    Returns
    Type Description
    InputControlScheme.MatchResult

    A InputControlScheme.MatchResult structure containing the result of the pick. Note that this structure must be manually Dispose() or unmanaged memory will be leaked.

    Type Parameters
    Name Description
    TDevices
    Remarks

    Does not allocate managed memory.

    ToJson()

    Declaration
    public string ToJson()
    Returns
    Type Description
    System.String

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()

    Operators

    Equality(InputControlScheme, InputControlScheme)

    Declaration
    public static bool operator ==(InputControlScheme left, InputControlScheme right)
    Parameters
    Type Name Description
    InputControlScheme left
    InputControlScheme right
    Returns
    Type Description
    System.Boolean

    Inequality(InputControlScheme, InputControlScheme)

    Declaration
    public static bool operator !=(InputControlScheme left, InputControlScheme right)
    Parameters
    Type Name Description
    InputControlScheme left
    InputControlScheme right
    Returns
    Type Description
    System.Boolean

    See Also

    controlSchemes
    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