Class InputActionRebindingExtensions.RebindingOperation
An ongoing rebinding operation.
Inheritance
Namespace: UnityEngine.InputSystem
Syntax
public sealed class RebindingOperation : IDisposable
Remarks
This class acts as both a configuration interface for rebinds as well as a controller while the rebind is ongoing. An instance can be reused arbitrary many times. Doing so can avoid allocating additional GC memory (the class internally retains state that it can reuse for multiple rebinds).
Note, however, that during rebinding it can be necessary to look at the InputControlLayout information registered in the system which means that layouts may have to be loaded. These will be cached for as long as the rebind operation is not disposed of.
A rebind operation may take several frames to complete. TODO
Note that not all types of controls make sense to perform interactive rebinding on. For example, TODO
Fields
kDefaultMagnitudeThreshold
Declaration
public const float kDefaultMagnitudeThreshold = 0.2F
Field Value
Type | Description |
---|---|
System.Single |
Properties
action
The action that rebinding is being performed on.
Declaration
public InputAction action { get; }
Property Value
Type | Description |
---|---|
InputAction |
See Also
bindingMask
Optional mask to determine which bindings to apply overrides to.
Declaration
public InputBinding? bindingMask { get; }
Property Value
Type | Description |
---|---|
System.Nullable<InputBinding> |
Remarks
If this is not null, all bindings that match this mask will have overrides applied to them.
canceled
Declaration
public bool canceled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
candidates
Controls that had input and were deemed potential matches to rebind to.
Declaration
public InputControlList<InputControl> candidates { get; }
Property Value
Type | Description |
---|---|
InputControlList<InputControl> |
Remarks
Controls in the list should be ordered by priority with the first element in the list being considered the best match.
See Also
completed
Declaration
public bool completed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
scores
The matching score for each control in candidates.
Declaration
public ReadOnlyArray<float> scores { get; }
Property Value
Type | Description |
---|---|
ReadOnlyArray<System.Single> |
selectedControl
Declaration
public InputControl selectedControl { get; }
Property Value
Type | Description |
---|---|
InputControl |
started
Declaration
public bool started { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
startTime
Declaration
public double startTime { get; }
Property Value
Type | Description |
---|---|
System.Double |
timeout
Declaration
public float timeout { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
AddCandidate(InputControl, Single)
Declaration
public void AddCandidate(InputControl control, float score)
Parameters
Type | Name | Description |
---|---|---|
InputControl | control | |
System.Single | score |
Cancel()
Declaration
public void Cancel()
Complete()
Manually complete the rebinding operation.
Declaration
public void Complete()
Dispose()
Declaration
public void Dispose()
Finalize()
Declaration
protected void Finalize()
OnApplyBinding(Action<InputActionRebindingExtensions.RebindingOperation, String>)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnApplyBinding(Action<InputActionRebindingExtensions.RebindingOperation, string> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<InputActionRebindingExtensions.RebindingOperation, System.String> | callback |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
OnCancel(Action<InputActionRebindingExtensions.RebindingOperation>)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnCancel(Action<InputActionRebindingExtensions.RebindingOperation> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<InputActionRebindingExtensions.RebindingOperation> | callback |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
OnComplete(Action<InputActionRebindingExtensions.RebindingOperation>)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnComplete(Action<InputActionRebindingExtensions.RebindingOperation> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<InputActionRebindingExtensions.RebindingOperation> | callback |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
OnComputeScore(Func<InputControl, InputEventPtr, Single>)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnComputeScore(Func<InputControl, InputEventPtr, float> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Func<InputControl, InputEventPtr, System.Single> | callback |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
OnGeneratePath(Func<InputControl, String>)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnGeneratePath(Func<InputControl, string> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Func<InputControl, System.String> | callback |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
OnMatchWaitForAnother(Single)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnMatchWaitForAnother(float seconds)
Parameters
Type | Name | Description |
---|---|---|
System.Single | seconds |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
OnPotentialMatch(Action<InputActionRebindingExtensions.RebindingOperation>)
Declaration
public InputActionRebindingExtensions.RebindingOperation OnPotentialMatch(Action<InputActionRebindingExtensions.RebindingOperation> callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action<InputActionRebindingExtensions.RebindingOperation> | callback |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
RemoveCandidate(InputControl)
Declaration
public void RemoveCandidate(InputControl control)
Parameters
Type | Name | Description |
---|---|---|
InputControl | control |
ResetConfiguration()
Declaration
public void ResetConfiguration()
Start()
Declaration
public InputActionRebindingExtensions.RebindingOperation Start()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithAction(InputAction)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithAction(InputAction action)
Parameters
Type | Name | Description |
---|---|---|
InputAction | action |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithBindingGroup(String)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithBindingGroup(string group)
Parameters
Type | Name | Description |
---|---|---|
System.String | group |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithBindingMask(Nullable<InputBinding>)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithBindingMask(InputBinding? bindingMask)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<InputBinding> | bindingMask |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithCancelingThrough(String)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithCancelingThrough(string binding)
Parameters
Type | Name | Description |
---|---|---|
System.String | binding |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithCancelingThrough(InputControl)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithCancelingThrough(InputControl control)
Parameters
Type | Name | Description |
---|---|---|
InputControl | control |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithControlsExcluding(String)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithControlsExcluding(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithControlsHavingToMatchPath(String)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithControlsHavingToMatchPath(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithExpectedControlLayout(String)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithExpectedControlLayout(string layoutName)
Parameters
Type | Name | Description |
---|---|---|
System.String | layoutName |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithExpectedControlType(Type)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithExpectedControlType(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithExpectedControlType<TControl>()
Declaration
public InputActionRebindingExtensions.RebindingOperation WithExpectedControlType<TControl>()
where TControl : InputControl
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
Type Parameters
Name | Description |
---|---|
TControl |
WithMagnitudeHavingToBeGreaterThan(Single)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithMagnitudeHavingToBeGreaterThan(float magnitude)
Parameters
Type | Name | Description |
---|---|---|
System.Single | magnitude |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithoutControlsHavingToMatchPath()
Declaration
public InputActionRebindingExtensions.RebindingOperation WithoutControlsHavingToMatchPath()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithoutGeneralizingPathOfSelectedControl()
Disable the default behavior of automatically generalizing the path of a selected control.
Declaration
public InputActionRebindingExtensions.RebindingOperation WithoutGeneralizingPathOfSelectedControl()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
Remarks
At runtime, every InputControl has a unique path in the system (path). However, when performing rebinds, we are not generally interested in the specific runtime path of the control -- which may depend on the number and types of devices present. In fact, most of the time we are not even interested in what particular brand of device the user is rebinding to but rather want to just bind based on the device's broad category.
For example, if the user has a DualShock controller and performs an interactive rebind, we usually do not want to generate override paths that reflect TODO
See Also
WithoutIgnoringNoisyControls()
Declaration
public InputActionRebindingExtensions.RebindingOperation WithoutIgnoringNoisyControls()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithoutMagnitudeThreshold()
Declaration
public InputActionRebindingExtensions.RebindingOperation WithoutMagnitudeThreshold()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithRebindAddingNewBinding(String)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithRebindAddingNewBinding(string group = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | group |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithRebindApplyingAsOverride()
Declaration
public InputActionRebindingExtensions.RebindingOperation WithRebindApplyingAsOverride()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithRebindOverwritingCurrentPath()
Declaration
public InputActionRebindingExtensions.RebindingOperation WithRebindOverwritingCurrentPath()
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithTargetBinding(Int32)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithTargetBinding(int bindingIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | bindingIndex |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
WithTimeout(Single)
Declaration
public InputActionRebindingExtensions.RebindingOperation WithTimeout(float timeInSeconds)
Parameters
Type | Name | Description |
---|---|---|
System.Single | timeInSeconds |
Returns
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |