Class RebindActionUI
A reusable component with a self-contained UI for rebinding a single action.
Inherited Members
Namespace: UnityEngine.InputSystem.Samples.RebindUI
Syntax
public class RebindActionUI : MonoBehaviour
Properties
actionLabel
Text component that receives the name of the action. Optional.
Declaration
public Text actionLabel { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.UI.Text |
actionReference
Reference to the action that is to be rebound.
Declaration
public InputActionReference actionReference { get; set; }
Property Value
Type | Description |
---|---|
InputActionReference |
bindingId
ID (in string form) of the binding that is to be rebound on the action.
Declaration
public string bindingId { get; set; }
Property Value
Type | Description |
---|---|
String |
See Also
bindingText
Text component that receives the display string of the binding. Can be null
in which
case the component entirely relies on updateBindingUIEvent.
Declaration
public Text bindingText { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.UI.Text |
displayStringOptions
Declaration
public InputBinding.DisplayStringOptions displayStringOptions { get; set; }
Property Value
Type | Description |
---|---|
InputBinding.DisplayStringOptions |
ongoingRebind
When an interactive rebind is in progress, this is the rebind operation controller.
Otherwise, it is null
.
Declaration
public InputActionRebindingExtensions.RebindingOperation ongoingRebind { get; }
Property Value
Type | Description |
---|---|
InputActionRebindingExtensions.RebindingOperation |
rebindOverlay
Optional UI that is activated when an interactive rebind is started and deactivated when the rebind is finished. This is normally used to display an overlay over the current UI while the system is waiting for a control to be actuated.
Declaration
public GameObject rebindOverlay { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Remarks
If neither rebindPrompt nor rebindOverlay
is set, the component will temporarily
replaced the bindingText (if not null
) with "Waiting..."
.
See Also
rebindPrompt
Optional text component that receives a text prompt when waiting for a control to be actuated.
Declaration
public Text rebindPrompt { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.UI.Text |
See Also
startRebindEvent
Event that is triggered when an interactive rebind is started on the action.
Declaration
public RebindActionUI.InteractiveRebindEvent startRebindEvent { get; }
Property Value
Type | Description |
---|---|
RebindActionUI.InteractiveRebindEvent |
stopRebindEvent
Event that is triggered when an interactive rebind has been completed or canceled.
Declaration
public RebindActionUI.InteractiveRebindEvent stopRebindEvent { get; }
Property Value
Type | Description |
---|---|
RebindActionUI.InteractiveRebindEvent |
updateBindingUIEvent
Event that is triggered every time the UI updates to reflect the current binding. This can be used to tie custom visualizations to bindings.
Declaration
public RebindActionUI.UpdateBindingUIEvent updateBindingUIEvent { get; }
Property Value
Type | Description |
---|---|
RebindActionUI.UpdateBindingUIEvent |
Methods
OnDisable()
Declaration
protected void OnDisable()
OnEnable()
Declaration
protected void OnEnable()
ResetToDefault()
Remove currently applied binding overrides.
Declaration
public void ResetToDefault()
ResolveActionAndBinding(out InputAction, out Int32)
Return the action and binding index for the binding that is targeted by the component according to
Declaration
public bool ResolveActionAndBinding(out InputAction action, out int bindingIndex)
Parameters
Type | Name | Description |
---|---|---|
InputAction | action | |
Int32 | bindingIndex |
Returns
Type | Description |
---|---|
Boolean |
StartInteractiveRebind()
Initiate an interactive rebind that lets the player actuate a control to choose a new binding for the action.
Declaration
public void StartInteractiveRebind()
UpdateBindingDisplay()
Trigger a refresh of the currently displayed binding.
Declaration
public void UpdateBindingDisplay()