Class InputRebindManager
A UI-agnostic facade that provides all the logic needed to build an input configuration/remapping screen in a game. It sits between the raw Scylla Input module managers and any UI implementation, handling data model building, modifier-aware rebinding, conflict detection, batch operations, and persistence integration.
Implements
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public class InputRebindManager : IDisposable
Remarks
The manager builds a structured, queryable data model from the registered IInputActionManager organized by configurable ConfigSchemeGroup instances. Each action produces one or more ConfigActionEntry instances (directional composites expand into per-part entries), each containing one ConfigBindingEntry per scheme group.
Typical usage:
var manager = new InputRebindManager(
ScyllaInput.Instance.ActionManager,
ScyllaInput.Instance.BindingManager,
ScyllaInput.Instance.ContextManager
);
manager.Initialize(
new ConfigSchemeGroup("WASD"),
new ConfigSchemeGroup("Gamepad", "<Gamepad>")
);
var entries = manager.GetEntriesForMap("Gameplay");
Constructors
InputRebindManager(IInputActionManager, IInputBindingManager, IInputContextManager)
Initializes a new InputRebindManager with the specified manager references.
Declaration
public InputRebindManager(IInputActionManager actionManager, IInputBindingManager bindingManager, IInputContextManager contextManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IInputActionManager | actionManager | The action manager providing access to all registered actions and bindings.
Must not be |
| IInputBindingManager | bindingManager | The binding manager providing rebinding, persistence, and conflict detection.
Must not be |
| IInputContextManager | contextManager | Optional context manager providing exclusion group and blocking queries for
conflict detection. Pass |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
Fields
DEFAULT_CLEAR_BINDING_PATH
Default Unity Input System control path for the clear binding key.
Declaration
public const string DEFAULT_CLEAR_BINDING_PATH = "<Keyboard>/delete"
Field Value
| Type | Description |
|---|---|
| string |
LABEL_NO_BINDING
Display text used when no binding exists for a scheme group.
Declaration
public const string LABEL_NO_BINDING = "--"
Field Value
| Type | Description |
|---|---|
| string |
Properties
ActionCount
Gets the number of actions counting only the first scheme group's bindings. This represents the number of unique action entries without inflating across multiple control schemes.
Declaration
public int ActionCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
ActionMapCount
Gets the number of action maps in the data model.
Declaration
public int ActionMapCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
BindingCountTotal
Gets the total number of bound binding entries across all entries and all scheme groups (e.g., 4 scheme groups with 60 actions = up to 240 total).
Declaration
public int BindingCountTotal { get; }
Property Value
| Type | Description |
|---|---|
| int |
ClearBindingPath
Gets or sets the Unity Input System control path that clears (unbinds) a binding when pressed during an active rebind session. The key assigned to this path cannot be used as a regular binding.
Declaration
public string ClearBindingPath { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A control path string (e.g., |
ConflictCount
Gets the number of rebindable-binding conflicts currently detected. Only counts conflicts on bindings that can be interactively remapped (excludes non-rebindable bindings like mouse scroll, gamepad sticks).
Declaration
public int ConflictCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsInCooldown
Gets a value indicating whether the manager is currently within the post-completion cooldown window during which StartRebind(string, int, string) calls are silently rejected.
Declaration
public bool IsInCooldown { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
UI callers should check this before preparing their own mid-rebind visual state (e.g., changing a cell's label to a prompt), otherwise a pointer-up OnClick that fires right after a mouse-button rebind completion would leave the UI stuck.
IsInitialized
Gets a value indicating whether this manager has been initialized.
Declaration
public bool IsInitialized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRebinding
Gets a value indicating whether a rebind operation is currently active.
Declaration
public bool IsRebinding { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MapIDs
Gets the ordered list of action map IDs discovered from the IInputActionManager.
Declaration
public IReadOnlyList<string> MapIDs { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
SchemeGroups
Gets the configured scheme groups that were passed to Initialize(params ConfigSchemeGroup[]).
Declaration
public IReadOnlyList<ConfigSchemeGroup> SchemeGroups { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<ConfigSchemeGroup> |
Methods
AutoResolveConflicts()
Automatically resolves all detected binding conflicts by remapping conflicting bindings to available, unmapped keys. Processes actions in sequential action map order; the first binding to claim a key wins, and later conflicting bindings are remapped.
Declaration
public AutoResolveResult AutoResolveConflicts()
Returns
| Type | Description |
|---|---|
| AutoResolveResult | An AutoResolveResult describing the changes made, how many conflicts were resolved, and how many remain. |
Remarks
Only key/button bindings are considered for remapping. Axes, deltas, sticks, and other non-discrete inputs are skipped. Currently only keyboard keys are supported as replacement candidates.
The key suggestion algorithm tries, in order:
- First letters of significant words in the action name (skipping common verbs).
- Remaining unique letters from the action name.
- All keyboard letters A-Z.
- Number keys 0-9.
- Function keys F1-F12.
If a binding in one scheme group is remapped, other scheme groups for the same action are also remapped only if they have a conflict on the same path.
BuildModifierCompositeDisplay(IReadOnlyList<ScyllaInputBinding>, int)
Convenience wrapper delegating to BuildModifierCompositeDisplay(IReadOnlyList<ScyllaInputBinding>, int).
Declaration
public static string BuildModifierCompositeDisplay(IReadOnlyList<ScyllaInputBinding> bindings, int partListIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<ScyllaInputBinding> | bindings | |
| int | partListIndex |
Returns
| Type | Description |
|---|---|
| string |
CancelRebind()
Cancels the currently active rebind operation, if any. Publishes a ManagedRebindCancelledEvent.
Declaration
public void CancelRebind()
ClearAll()
Clears all binding overrides by setting each rebindable binding to an empty path. Refreshes the data model after clearing.
Declaration
public void ClearAll()
Dispose()
Releases all resources held by this manager and clears the data model.
Declaration
public void Dispose()
FormatPartName(string)
Convenience wrapper delegating to FormatPartName(string).
Declaration
public static string FormatPartName(string partName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | partName |
Returns
| Type | Description |
|---|---|
| string |
GetAllConflicts()
Returns all conflicts detected across all actions in the data model.
Declaration
public IReadOnlyList<ConfigConflict> GetAllConflicts()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ConfigConflict> | A read-only list of ConfigConflict instances. |
GetAllEntries()
Returns all action entries across all maps, in the order they were discovered.
Declaration
public IReadOnlyList<ConfigActionEntry> GetAllEntries()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ConfigActionEntry> |
GetConflictsForAction(string)
Returns all conflicts detected for the specified action across all its binding entries and scheme groups.
Declaration
public IReadOnlyList<ConfigConflict> GetConflictsForAction(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID to check for conflicts. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ConfigConflict> | A read-only list of ConfigConflict instances, one per detected conflict. Returns an empty list if no conflicts are found. |
GetConflictsForBinding(string, int, string, string, string)
Returns all conflicts for a specific binding in a specific scheme group. Use this for per-row conflict detection in directional composites where multiple rows share the same action ID but have different binding indices.
Declaration
public IReadOnlyList<ConfigConflict> GetConflictsForBinding(string actionID, int bindingIndex, string mapID, string schemeGroup, string effectivePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID owning the binding. |
| int | bindingIndex | The flat Unity binding index to check. |
| string | mapID | The action map ID for context resolution. |
| string | schemeGroup | The scheme group to scope the conflict check. |
| string | effectivePath | The effective control path to check for conflicts. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ConfigConflict> | A read-only list of ConfigConflict instances for this specific binding. |
GetEntriesForAction(string)
Returns all action entries for the specified action ID. For simple actions this returns a single entry. For directional composites this returns one entry per composite part (e.g., Up, Down, Left, Right).
Declaration
public IReadOnlyList<ConfigActionEntry> GetEntriesForAction(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID to query. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ConfigActionEntry> | A read-only list of entries, or an empty list if the action is not found. |
GetEntriesForMap(string)
Returns all action entries belonging to the specified action map.
Declaration
public IReadOnlyList<ConfigActionEntry> GetEntriesForMap(string mapID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | mapID | The action map ID to query. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ConfigActionEntry> | A read-only list of entries for the map, or an empty list if the map ID is not found. |
HasConflicts(string)
Returns whether the specified action has any binding conflicts.
Declaration
public bool HasConflicts(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID to check. |
Returns
| Type | Description |
|---|---|
| bool |
|
Initialize(params ConfigSchemeGroup[])
Initializes the manager with the specified scheme groups and builds the data model from the registered action maps.
Declaration
public void Initialize(params ConfigSchemeGroup[] schemeGroups)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigSchemeGroup[] | schemeGroups | One or more ConfigSchemeGroup instances defining which control schemes the manager should process. The order determines the order of Bindings. |
Remarks
Only bindings that belong to one of the supplied schemeGroups
(or that are scheme-less - i.e. have an empty Groups string, such as
Console/Global actions) are processed. Bindings tagged with a scheme the caller
did not register are silently ignored across all manager operations: they are
not displayed in the data model, not considered for conflict detection, not
included in occupiedPaths during auto-resolve, and are left untouched
inside the input actions asset.
A caller that registers only "WASD" therefore gets a single-column
binding table; registering "WASD" and "Gamepad" produces a
two-column table and scopes all processing to those two schemes.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when no scheme groups are provided. |
IsBindingRebindable(ScyllaInputBinding)
Convenience wrapper delegating to IsBindingRebindable(ScyllaInputBinding).
Declaration
public static bool IsBindingRebindable(ScyllaInputBinding binding)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaInputBinding | binding |
Returns
| Type | Description |
|---|---|
| bool |
IsInModifierComposite(IReadOnlyList<ScyllaInputBinding>, int)
Convenience wrapper delegating to IsInModifierComposite(IReadOnlyList<ScyllaInputBinding>, int).
Declaration
public static bool IsInModifierComposite(IReadOnlyList<ScyllaInputBinding> bindings, int listIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<ScyllaInputBinding> | bindings | |
| int | listIndex |
Returns
| Type | Description |
|---|---|
| bool |
LoadBindings(string)
Loads binding overrides from the configured IBindingStorage and refreshes the data model.
Declaration
public void LoadBindings(string profileID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profileID | Optional profile ID. Pass |
RefreshAction(string)
Refreshes the binding entries for a specific action, updating display text, effective paths, and override status without rebuilding the entire model.
Declaration
public void RefreshAction(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID whose entries should be refreshed. |
RefreshAll()
Rebuilds the entire data model from the current state of the action manager. Call this after loading bindings or resetting to defaults to refresh all entries.
Declaration
public void RefreshAll()
ResetAction(string)
Resets bindings for a specific action to their default values and refreshes that action's entries.
Declaration
public void ResetAction(string actionID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID to reset. |
ResetAll()
Resets all bindings to their default values and refreshes the data model.
Declaration
public void ResetAll()
SaveBindings(string)
Saves the current binding overrides via the configured IBindingStorage.
Declaration
public void SaveBindings(string profileID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profileID | Optional profile ID. Pass |
StartRebind(string, int, string)
Starts an interactive rebind for the specified action and binding. Automatically selects the rebinding mode based on the binding's device type: keyboard bindings use modifier-aware polling (supports Shift+A combos), while gamepad and mouse bindings use Unity's native interactive rebinding. Publishes a ManagedRebindStartedEvent on start.
Declaration
public void StartRebind(string actionID, int bindingIndex, string schemeGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The action ID to rebind. |
| int | bindingIndex | The flat Unity binding index to rebind. |
| string | schemeGroup | The scheme group context for this rebind. |