InputPrompt is a Button subclass that displays the right keyboard or gamepad icon for an input action and re-renders automatically when the active control scheme changes. It also supports a hold-to-confirm radial progress overlay for actions with HoldInteraction.

Input

Setup

UXML — declare the element under Luna's namespace and bind it to an input action:

html
<luna:InputPrompt InputActionName="UI/Submit" />

Runtime requirements:

  • Active PlayerInput registered with InputDeviceManager.
  • A LunaUIManager in the scene with a populated InputIconDatabase (icon-per-control-scheme lookup).

The prompt subscribes to InputDeviceManager.OnControlSchemeChange, OnPlayerAdded, OnPlayerRemoved on attach and unsubscribes on detach.

Inspector (UxmlAttributes)

AttributeTypeDescription
InputActionNamestringAction map / action path (default "UI/Submit").
OverrideIconSpriteSpriteForces a specific icon, bypassing InputIconDatabase.
OverrideIconTextstringForces a specific label text on the icon.
SliceboolAdds the slice USS class so the icon background renders 9-sliced.
LabelTextstringOptional text label rendered next to the icon.
ButtonIfList<InputIconControlScheme>Schemes for which the prompt is interactable (default: KeyboardMouse only). On gamepad it's auto-disabled so D-pad navigation skips it.
HideIfList<InputIconControlScheme>Schemes for which the prompt is hidden entirely.
HideboolForce-hides the prompt regardless of scheme.
PlayerIndexintWhich player this prompt represents (multiplayer).
HideIfPlayerIndexMissingboolIf the indexed player has no PlayerInput, hide the prompt (default true).

InputIconControlScheme

csharp
public enum InputIconControlScheme { KeyboardMouse, Xbox, PlayStation4, PlayStation5 }

CSS classes

ClassApplied when
InputPromptAlways (root). Inherits btn.
has-iconAn icon sprite is set (override or from database).
circleNon-keyboard scheme without an explicit Square flag.
holdThe bound action has a HoldInteraction and tracking is active.
hold-complete-animToggled briefly to drive the hold-complete pop animation.
InputPrompt__icon_container / __icon_sprite / __icon_slice / __icon_label / __label / __holdInternal sub-elements.

API

Properties

PropertyTypeDescription
ActionInputActionThe resolved input action (after attach). UNITY_INPUT only.
BindingIndexintActive binding index used to pick the icon.

Methods

MethodDescription
OnAttach() / OnDetach()Wire/unwire InputDeviceManager callbacks. Called automatically.
AddHold()Lazily attach the radial hold indicator.
HoldOnEnable() / HoldOnDisable()Subscribe/unsubscribe to the action's started/performed/canceled events that drive the hold animation.
StartHoldAnimation(float duration)Manually trigger the radial fill (uses InputSystem.settings.defaultHoldTime if duration <= 0).
StoptHoldAnimation()Pause the radial-fill scheduler.

Events

csharp
public event Action OnUpdate;

Fires after each UpdateBindingDisplay pass — useful for re-laying-out adjacent UI when icons resize.

Integration

InputDeviceManager

InputDeviceManager detects scheme changes and tracks per-player PlayerInputs. InputPrompt subscribes on attach so the icon, label, and visibility update without any glue code.

Input Device Manager

LunaUIManager + InputIconDatabase

LunaUIManager exposes IconDatabase (an InputIconDatabaseSO). When InputPrompt updates, it queries the database via GetInputPromptFromName(playerInput, InputActionName) to resolve the right sprite + glyph text for the active scheme.

Default icon set: kenney.nl input prompts.

Input Icon Database

See also

Settings

Theme

Light

Contrast

Material

Dark

Dim

Material Dark

System

Sidebar(Light & Contrast only)

Light
Dark

Font Family

DM Sans

Wix

Inclusive Sans

AR One Sans

Direction

LTR
RTL