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

    Class InputActionSetupExtensions

    Extensions to set up InputAction and InputActionMap.

    Inheritance
    System.Object
    InputActionSetupExtensions
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.Input
    Syntax
    public static class InputActionSetupExtensions

    Methods

    AddAction(InputActionMap, String, String, String, String, String)

    Declaration
    public static InputAction AddAction(this InputActionMap map, string name, string binding = null, string interactions = null, string groups = null, string expectedControlLayout = null)
    Parameters
    Type Name Description
    InputActionMap map
    System.String name
    System.String binding
    System.String interactions
    System.String groups
    System.String expectedControlLayout
    Returns
    Type Description
    InputAction

    AddActionMap(InputActionAsset, String)

    Declaration
    public static InputActionMap AddActionMap(this InputActionAsset asset, string name)
    Parameters
    Type Name Description
    InputActionAsset asset
    System.String name
    Returns
    Type Description
    InputActionMap

    AddBinding(InputAction, String, String, String)

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputAction action, string path, string interactions = null, string groups = null)
    Parameters
    Type Name Description
    InputAction action
    System.String path
    System.String interactions
    System.String groups
    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    AddBinding(InputAction, InputBinding)

    Add a new binding to the action.

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputAction action, InputBinding binding)
    Parameters
    Type Name Description
    InputAction action

    A disabled action to add the binding to.

    InputBinding binding
    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    Returns a fluent-style syntax structure that allows performing additional modifications based on the new binding.

    Remarks

    This works both with actions that are part of an action set as well as with actions that aren't.

    Note that actions must be disabled while altering their binding sets. Also, if the action belongs to a set, all actions in the set must be disabled.

    AddBinding(InputAction, InputControl)

    Add a binding that references the given control and triggers the given .

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputAction action, InputControl control)
    Parameters
    Type Name Description
    InputAction action

    Action to trigger. Also determines where to add the binding. If the action is not part of an InputActionMap, the binding is added directly to action. If it is part of a map, the binding is added to the action map (actionMap).

    InputControl control

    Control to binding to. The full path of the control will be used in the resulting InputBinding.

    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    Syntax to configure the binding further.

    See Also
    bindings

    AddBinding(InputActionMap, String, Guid, String, String)

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputActionMap actionMap, string path, Guid action, string interactions = null, string groups = null)
    Parameters
    Type Name Description
    InputActionMap actionMap
    System.String path
    Guid action
    System.String interactions
    System.String groups
    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    AddBinding(InputActionMap, String, String, String, String)

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputActionMap actionMap, string path, string interactions = null, string groups = null, string action = null)
    Parameters
    Type Name Description
    InputActionMap actionMap
    System.String path
    System.String interactions
    System.String groups
    System.String action
    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    AddBinding(InputActionMap, String, InputAction, String, String)

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputActionMap actionMap, string path, InputAction action, string interactions = null, string groups = null)
    Parameters
    Type Name Description
    InputActionMap actionMap
    System.String path
    InputAction action
    System.String interactions
    System.String groups
    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    AddBinding(InputActionMap, InputBinding)

    Declaration
    public static InputActionSetupExtensions.BindingSyntax AddBinding(this InputActionMap actionMap, InputBinding binding)
    Parameters
    Type Name Description
    InputActionMap actionMap
    InputBinding binding
    Returns
    Type Description
    InputActionSetupExtensions.BindingSyntax

    AddCompositeBinding(InputAction, String, String)

    Declaration
    public static InputActionSetupExtensions.CompositeSyntax AddCompositeBinding(this InputAction action, string composite, string interactions = null)
    Parameters
    Type Name Description
    InputAction action
    System.String composite
    System.String interactions
    Returns
    Type Description
    InputActionSetupExtensions.CompositeSyntax

    AddControlScheme(InputActionAsset, String)

    Add a new control scheme to the given asset.

    Declaration
    public static InputActionSetupExtensions.ControlSchemeSyntax AddControlScheme(this InputActionAsset asset, string name)
    Parameters
    Type Name Description
    InputActionAsset asset

    Asset to add the control scheme to.

    System.String name

    Name to give to the control scheme. Must be unique within the control schemes of the asset. Also used as default name of bindingGroup associated with the control scheme.

    Returns
    Type Description
    InputActionSetupExtensions.ControlSchemeSyntax

    Syntax to allow providing additional configuration for the newly added control scheme.

    OrWithOptionalDevice(InputControlScheme, String)

    Declaration
    public static InputControlScheme OrWithOptionalDevice(this InputControlScheme scheme, string controlPath)
    Parameters
    Type Name Description
    InputControlScheme scheme
    System.String controlPath
    Returns
    Type Description
    InputControlScheme

    OrWithRequiredDevice(InputControlScheme, String)

    Declaration
    public static InputControlScheme OrWithRequiredDevice(this InputControlScheme scheme, string controlPath)
    Parameters
    Type Name Description
    InputControlScheme scheme
    System.String controlPath
    Returns
    Type Description
    InputControlScheme

    Rename(InputAction, String)

    Rename an existing action.

    Declaration
    public static void Rename(this InputAction action, string newName)
    Parameters
    Type Name Description
    InputAction action

    Action to assign a new name to. Can be singleton action or action that is part of a map.

    System.String newName

    New name to assign to action. Cannot be empty.

    Rename(InputActionAsset, InputActionMap)

    Declaration
    public static void Rename(this InputActionAsset asset, InputActionMap map)
    Parameters
    Type Name Description
    InputActionAsset asset
    InputActionMap map

    WithBindingGroup(InputControlScheme, String)

    Declaration
    public static InputControlScheme WithBindingGroup(this InputControlScheme scheme, string bindingGroup)
    Parameters
    Type Name Description
    InputControlScheme scheme
    System.String bindingGroup
    Returns
    Type Description
    InputControlScheme

    WithOptionalDevice(InputControlScheme, String)

    Declaration
    public static InputControlScheme WithOptionalDevice(this InputControlScheme scheme, string controlPath)
    Parameters
    Type Name Description
    InputControlScheme scheme
    System.String controlPath
    Returns
    Type Description
    InputControlScheme

    WithRequiredDevice(InputControlScheme, String)

    Declaration
    public static InputControlScheme WithRequiredDevice(this InputControlScheme scheme, string controlPath)
    Parameters
    Type Name Description
    InputControlScheme scheme
    System.String controlPath
    Returns
    Type Description
    InputControlScheme
    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