Class InputHintsManager
Default implementation of IInputHintsManager. Manages dynamic button prompt icons based on the current input bindings and the active control scheme. Provides UI-ready InputHint data with an internal per-action cache that is automatically invalidated when bindings or control schemes change.
Implements
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public class InputHintsManager : IInputHintsManager
Remarks
The manager subscribes to InputRebindCompletedEvent and InputBindingsLoadedEvent via the Scylla Event eXchange System to invalidate per-action or full hint caches respectively. It also subscribes directly to OnSchemeChanged for scheme-switch driven cache invalidation.
Icon set selection follows a four-step fallback chain when resolving a hint for a given scheme type:
- The icon set explicitly assigned via SetIconSetForScheme(ControlSchemeType, string).
- The global active icon set (ActiveIconSetID).
- The first registered icon set whose PrimarySchemeType matches.
- The first registered icon set of any type.
Binding path resolution follows a two-step fallback: first a binding whose device type matches the target scheme's device family; then the first non-composite binding available. Display text falls back from the icon set's DisplayText to Unity's own binding display string when no icon set mapping covers the path.
Properties
ActiveIconSetID
Gets the ID of the icon set that is currently designated as the global default.
Individual schemes may override this via SetIconSetForScheme(ControlSchemeType, string).
Returns null if no icon set has been explicitly activated.
Declaration
public string ActiveIconSetID { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsInitialized
Gets a value indicating whether this hints manager has been successfully
initialized via Initialize(IInputActionManager, IControlSchemeManager). Hint retrieval methods return
Invalid and icon lookups return null when
this is false.
Declaration
public bool IsInitialized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
~InputHintsManager()
Finalizer that ensures SEX event subscriptions are disposed even if Shutdown() is never called. This is a defensive measure against leaked subscriptions; callers should always call Shutdown() explicitly as part of clean teardown.
Declaration
protected ~InputHintsManager()
GetActionDisplayText(string)
Returns the human-readable display string for the specified action's binding
under the currently active control scheme (e.g., "Space", "A",
"Left Click").
Declaration
public string GetActionDisplayText(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The string identifier of the action as registered with
IInputActionManager. Must not be |
Returns
| Type | Description |
|---|---|
| string | The display string from the matched icon set mapping, or the Unity Input System's
own binding display string if no icon set mapping is found. Returns |
GetActionIcon(string)
Returns the icon UnityEngine.Sprite for the specified action using the currently active control scheme to select the appropriate binding and icon set.
Declaration
public Sprite GetActionIcon(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The string identifier of the action as registered with
IInputActionManager. Must not be |
Returns
| Type | Description |
|---|---|
| Sprite | The icon UnityEngine.Sprite from the active icon set for the action's binding,
or |
GetActionIcon(string, ControlSchemeType)
Returns the icon UnityEngine.Sprite for the specified action using a particular control scheme type to select the binding path and icon set.
Declaration
public Sprite GetActionIcon(string actionID, ControlSchemeType schemeType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The string identifier of the action as registered with
IInputActionManager. Must not be |
| ControlSchemeType | schemeType | The ControlSchemeType whose icon set and device bindings should be used for the lookup. Pass Unknown to fall back to the general active icon set. |
Returns
| Type | Description |
|---|---|
| Sprite | The icon UnityEngine.Sprite for the binding that matches the given scheme type,
or |
GetActionIcon(string, string)
Returns the icon UnityEngine.Sprite for the specified action using a specific named icon set, bypassing the scheme-based selection logic.
Declaration
public Sprite GetActionIcon(string actionID, string iconSetID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The string identifier of the action as registered with
IInputActionManager. Must not be |
| string | iconSetID | The ID of the InputIconSet to query directly. If the icon set is
not registered the method returns |
Returns
| Type | Description |
|---|---|
| Sprite | The icon UnityEngine.Sprite from the specified icon set for the action's binding
path, or |
GetAllIconSets()
Returns a read-only snapshot of all currently registered icon sets in registration order.
Declaration
public IReadOnlyList<InputIconSet> GetAllIconSets()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<InputIconSet> | A read-only list of InputIconSet instances. The list is empty when no icon sets have been registered. The returned reference is stable until the next call to RegisterIconSet(InputIconSet) or UnregisterIconSet(string). |
GetHint(string)
Returns the complete InputHint for the specified action under the currently active control scheme. Results are cached; the cache is invalidated automatically when bindings or the active scheme change.
Declaration
public InputHint GetHint(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The string identifier of the action as registered with
IInputActionManager. Must not be |
Returns
| Type | Description |
|---|---|
| InputHint | An InputHint containing the display text, icon sprite, binding path, and scheme type, or Invalid if the action is not found, the manager is not initialized, or no binding can be resolved. |
GetHint(string, ControlSchemeType)
Returns the complete InputHint for the specified action under a
specific control scheme type. Results are cached per
(actionID, schemeType) key.
Declaration
public InputHint GetHint(string actionID, ControlSchemeType schemeType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The string identifier of the action as registered with
IInputActionManager. Must not be |
| ControlSchemeType | schemeType | The ControlSchemeType for which to retrieve the hint. The method selects the icon set configured for this scheme via SetIconSetForScheme(ControlSchemeType, string) (falling back to the active icon set, then the first icon set registered for the scheme, then any available icon set). |
Returns
| Type | Description |
|---|---|
| InputHint | An InputHint for the given action and scheme, or Invalid if no binding or icon set data could be resolved. |
GetIconSet(string)
Returns the registered InputIconSet with the specified ID.
Declaration
public InputIconSet GetIconSet(string iconSetID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | iconSetID | The ID of the icon set to retrieve. Must not be |
Returns
| Type | Description |
|---|---|
| InputIconSet | The InputIconSet instance, or |
GetIconSetForScheme(ControlSchemeType)
Returns the icon set ID that has been explicitly configured for the given control scheme type via SetIconSetForScheme(ControlSchemeType, string).
Declaration
public string GetIconSetForScheme(ControlSchemeType schemeType)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlSchemeType | schemeType | The ControlSchemeType to query. |
Returns
| Type | Description |
|---|---|
| string | The configured icon set ID, or |
HasIconSet(string)
Checks whether an icon set with the given ID is currently registered.
Declaration
public bool HasIconSet(string iconSetID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | iconSetID | The ID to check. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|
Initialize(IInputActionManager, IControlSchemeManager)
Initializes the hints manager and subscribes to binding change and control scheme change events for automatic cache invalidation. Must be called once before any hint retrieval methods are used. Subsequent calls while already initialized are logged as warnings and are otherwise ignored.
Declaration
public void Initialize(IInputActionManager actionManager, IControlSchemeManager controlSchemeManager)
Parameters
| Type | Name | Description |
|---|---|---|
| IInputActionManager | actionManager | The IInputActionManager used to look up registered actions and
their current binding paths. Must not be |
| IControlSchemeManager | controlSchemeManager | The IControlSchemeManager used to determine the active scheme type
for default hint queries and to receive scheme-change callbacks. May be
|
InvalidateCache()
Clears all cached InputHint entries, forcing every subsequent hint query to rebuild its result from the current binding and icon set data. This is called automatically by the hints manager when bindings or the active scheme change; calling it manually is only necessary when icon set mappings are modified at runtime outside of the standard registration API.
Declaration
public void InvalidateCache()
InvalidateCache(string)
Clears all cached InputHint entries for the given action ID across all scheme types, and raises OnHintChanged to notify subscribers. This is called automatically after a successful rebind for the affected action; calling it manually is only necessary when binding data is modified externally.
Declaration
public void InvalidateCache(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The ID of the action whose cached hints should be invalidated. Cache entries for
all ControlSchemeType variants of this action are removed.
A |
RegisterIconSet(InputIconSet)
Registers an InputIconSet asset with the hints manager, making its binding-to-sprite mappings available for hint lookups. If the icon set's PrimarySchemeType is not yet mapped to any icon set, this set is automatically assigned as the default for that scheme. Registering an icon set invalidates the hint cache.
Declaration
public bool RegisterIconSet(InputIconSet iconSet)
Parameters
| Type | Name | Description |
|---|---|---|
| InputIconSet | iconSet | The icon set to register. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|
SetActiveIconSet(string)
Sets the globally active icon set by ID, used as the default fallback when no scheme-specific set is configured. Setting the active icon set invalidates the hint cache and raises OnIconSetChanged.
Declaration
public void SetActiveIconSet(string iconSetID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | iconSetID | The ID of the icon set to activate. May be |
SetIconSetForScheme(ControlSchemeType, string)
Associates a specific icon set with a control scheme type so that all hint lookups for that scheme retrieve icons from the given set. This takes precedence over the globally active icon set. Changes invalidate the hint cache.
Declaration
public void SetIconSetForScheme(ControlSchemeType schemeType, string iconSetID)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlSchemeType | schemeType | The ControlSchemeType to configure. |
| string | iconSetID | The ID of the icon set to use for the scheme, or |
Shutdown()
Shuts down the hints manager, unsubscribes all internal event listeners, clears
all registered icon sets and cached hints, and releases references to the action
and control scheme managers. After this call IsInitialized is
false and all hint retrieval methods return empty or invalid results.
Declaration
public void Shutdown()
UnregisterIconSet(string)
Unregisters the InputIconSet with the given ID, removing its mappings from the hints manager. If the removed set was the configured set for its PrimarySchemeType, that scheme's mapping is cleared. If the removed set was the active icon set, the active set is reassigned to the first remaining icon set, or cleared if none remain. Unregistering invalidates the hint cache.
Declaration
public bool UnregisterIconSet(string iconSetID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | iconSetID | The ID of the icon set to remove. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|
Events
OnHintChanged
Raised when the cached hint for a specific action is invalidated and the hint data should be considered stale. The string argument is the action ID whose hint changed. UI components displaying a prompt for a single action can subscribe to this event instead of listening to the broader OnIconSetChanged.
Declaration
public event Action<string> OnHintChanged
Event Type
| Type | Description |
|---|---|
| Action<string> |
OnIconSetChanged
Raised when the active icon set changes globally or per-scheme, indicating that
all displayed button prompts may need to be refreshed. The string argument is the
ID of the newly active icon set (may be null if the active set was
cleared). This event is also raised in response to control scheme switches.
Declaration
public event Action<string> OnIconSetChanged
Event Type
| Type | Description |
|---|---|
| Action<string> |