Extensions to help with dynamically rebinding InputAction in
various ways.
Inheritance
System.Object
InputActionRebindingExtensions
public static class InputActionRebindingExtensions
Methods
Declaration
public static void ApplyBindingOverride(this InputAction action, int bindingIndex, string path)
Parameters
Type |
Name |
Description |
InputAction |
action |
|
System.Int32 |
bindingIndex |
|
System.String |
path |
|
Declaration
public static void ApplyBindingOverride(this InputAction action, int bindingIndex, InputBinding bindingOverride)
Parameters
Declaration
public static void ApplyBindingOverride(this InputAction action, string newPath, string group = null, string path = null)
Parameters
Type |
Name |
Description |
InputAction |
action |
|
System.String |
newPath |
|
System.String |
group |
|
System.String |
path |
|
Declaration
public static void ApplyBindingOverride(this InputAction action, InputBinding bindingOverride)
Parameters
Declaration
public static void ApplyBindingOverride(this InputActionMap actionMap, int bindingIndex, InputBinding bindingOverride)
Parameters
Apply the given binding override to all bindings in the map that are matched by the override.
Declaration
public static int ApplyBindingOverride(this InputActionMap actionMap, InputBinding bindingOverride)
Parameters
Returns
Type |
Description |
System.Int32 |
The number of bindings overridden in the given map.
|
Exceptions
Type |
Condition |
System.ArgumentNullException |
actionMap is null .
|
System.InvalidOperationException |
actionMap is currently enabled.
|
Declaration
public static void ApplyBindingOverrides(this InputActionMap actionMap, IEnumerable<InputBinding> overrides)
Parameters
Declaration
public static int ApplyBindingOverridesOnMatchingControls(this InputAction action, InputControl control)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Declaration
public static int ApplyBindingOverridesOnMatchingControls(this InputActionMap actionMap, InputControl control)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Declaration
public static IEnumerable<InputBinding> GetBindingOverrides(this InputAction action)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<InputBinding> |
|
Declaration
public static int GetBindingOverrides(this InputAction action, List<InputBinding> overrides)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Get all overrides applied to bindings in the given map.
Declaration
public static IEnumerable<InputBinding> GetBindingOverrides(this InputActionMap actionMap)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<InputBinding> |
|
Declaration
public static int GetBindingOverrides(this InputActionMap actionMap, List<InputBinding> overrides)
Parameters
Returns
Type |
Description |
System.Int32 |
|
Initiate an operation that interactively rebinds the given action based on received input.
Declaration
public static InputActionRebindingExtensions.RebindingOperation PerformInteractiveRebinding(this InputAction action)
Parameters
Type |
Name |
Description |
InputAction |
action |
Action to perform rebinding on.
|
Returns
Exceptions
Type |
Condition |
System.ArgumentNullException |
|
System.ArgumentException |
|
Declaration
public static void RemoveAllBindingOverrides(this InputAction action)
Parameters
Restore all bindings in the map to their defaults.
Declaration
public static void RemoveAllBindingOverrides(this InputActionMap actionMap)
Parameters
Type |
Name |
Description |
InputActionMap |
actionMap |
Action map to remove overrides from. Must not have enabled actions.
|
Exceptions
Type |
Condition |
System.ArgumentNullException |
actionMap is null .
|
System.InvalidOperationException |
actionMap is currently enabled.
|
Declaration
public static void RemoveBindingOverride(this InputAction action, InputBinding bindingOverride)
Parameters
Declaration
public static void RemoveBindingOverrides(this InputActionMap actionMap, IEnumerable<InputBinding> overrides)
Parameters
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.