Interface IInputBridgeManager
Manages the collection of registered IScyllaInputBridge instances and routes all input queries to the appropriate bridge based on the configured query strategy.
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public interface IInputBridgeManager
Remarks
The bridge manager is the single point of access for all raw-device input within the Scylla Input module. It maintains a priority-sorted list of registered bridges and delegates keyboard, mouse, and gamepad queries to them according to the active QueryMode.
Four query modes are available (see InputBridgeQueryMode):
- SingleBridge Only the highest-priority bridge is consulted. This is the default and matches backward-compatible single-bridge behavior.
- PriorityChain
Bridges are queried in descending priority order. For boolean queries,
the first bridge returning
truewins. For analog queries, the first bridge with a non-zero value wins. - PerInputType A specific bridge is designated for each InputDeviceType via SetBridgeForInputType(InputDeviceType, string). Unassigned types fall back to the highest-priority bridge.
- CombineAll All available bridges are queried. Boolean results use OR semantics; analog results use the largest absolute value.
By default a single UnityInputSystemBridge is registered at priority 100. Additional bridges can be registered at runtime for scenarios such as mixing input backends per device type.
Properties
ActiveBridge
Gets the highest-priority bridge that is currently registered.
Declaration
IScyllaInputBridge ActiveBridge { get; }
Property Value
| Type | Description |
|---|---|
| IScyllaInputBridge | The first entry in the priority-sorted Bridges list, or |
Bridges
Gets the full list of registered bridges in descending priority order.
Declaration
IReadOnlyList<IScyllaInputBridge> Bridges { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<IScyllaInputBridge> | A read-only view of all bridges, sorted so that the highest-priority bridge is at index 0. The list is re-sorted whenever a bridge is registered or its priority changes via SetBridgePriority(string, int). |
ConflictResolution
Gets or sets the strategy used to resolve conflicting analog values when multiple bridges each return a non-zero result.
Declaration
InputConflictResolution ConflictResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| InputConflictResolution | One of the InputConflictResolution values. Defaults to HighestPriority. This setting is most relevant when QueryMode is CombineAll or PriorityChain. |
QueryMode
Gets or sets the strategy used to select which bridge(s) answer input queries.
Declaration
InputBridgeQueryMode QueryMode { get; set; }
Property Value
| Type | Description |
|---|---|
| InputBridgeQueryMode | One of the InputBridgeQueryMode values. Defaults to SingleBridge, which provides the same behavior as a single-bridge setup. Changes take effect immediately on the next input query. |
Methods
ClearBridgeForInputType(InputDeviceType)
Removes the per-input-type bridge assignment for the given device category, reverting to the default ActiveBridge for that type.
Declaration
void ClearBridgeForInputType(InputDeviceType inputType)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDeviceType | inputType | The InputDeviceType whose routing assignment should be cleared. If no assignment exists, the call is a safe no-op. |
GetAllDevices()
Returns the list of all input devices reported by the active bridge.
Declaration
IReadOnlyList<InputDevice> GetAllDevices()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<InputDevice> | A read-only list of currently connected and enabled devices as seen by the ActiveBridge; an empty list if no bridges are registered or the active bridge reports no devices. |
Remarks
This method currently delegates to the ActiveBridge only. In future multi-bridge scenarios, device lists from all bridges may be merged.
GetBridge(string)
Retrieves a registered bridge by its ID.
Declaration
IScyllaInputBridge GetBridge(string bridgeID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bridgeID | The BridgeID to look up. |
Returns
| Type | Description |
|---|---|
| IScyllaInputBridge | The registered IScyllaInputBridge with the given ID, or |
GetBridgeForInputType(InputDeviceType)
Returns the bridge ID that is currently assigned to handle a specific input device type.
Declaration
string GetBridgeForInputType(InputDeviceType inputType)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDeviceType | inputType | The InputDeviceType to query. |
Returns
| Type | Description |
|---|---|
| string | The BridgeID of the assigned bridge, or |
GetBridgePriority(string)
Returns the effective priority of a registered bridge, accounting for any runtime override set via SetBridgePriority(string, int).
Declaration
int GetBridgePriority(string bridgeID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bridgeID | The BridgeID to query. |
Returns
| Type | Description |
|---|---|
| int | The override priority if one has been set, otherwise the bridge's own
Priority value, or |
GetCurrentGamepad()
Returns a reference to the primary active gamepad as reported by the bridge designated for gamepad queries.
Declaration
Gamepad GetCurrentGamepad()
Returns
| Type | Description |
|---|---|
| Gamepad | The current UnityEngine.InputSystem.Gamepad, or |
GetDeviceType(InputDevice)
Classifies an input device into one of the known InputDeviceType categories using the active bridge's classification logic.
Declaration
InputDeviceType GetDeviceType(InputDevice device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDevice | device | The device to classify. May be |
Returns
| Type | Description |
|---|---|
| InputDeviceType | The InputDeviceType that describes |
GetGamepadLeftStick()
Returns the current value of the left analog stick on the active gamepad, resolved through the active bridge selection strategy.
Declaration
Vector2 GetGamepadLeftStick()
Returns
| Type | Description |
|---|---|
| Vector2 | A UnityEngine.Vector2 with components in [-1, 1]; UnityEngine.Vector2.zero if no gamepad is connected or no bridges are registered. |
GetGamepadLeftTrigger()
Returns the current analog value of the left trigger on the active gamepad, resolved through the active bridge selection strategy.
Declaration
float GetGamepadLeftTrigger()
Returns
| Type | Description |
|---|---|
| float | A value in [0, 1] where 0 is fully released and 1 is fully pressed; |
GetGamepadRightStick()
Returns the current value of the right analog stick on the active gamepad, resolved through the active bridge selection strategy.
Declaration
Vector2 GetGamepadRightStick()
Returns
| Type | Description |
|---|---|
| Vector2 | A UnityEngine.Vector2 with components in [-1, 1]; UnityEngine.Vector2.zero if no gamepad is connected or no bridges are registered. |
GetGamepadRightTrigger()
Returns the current analog value of the right trigger on the active gamepad, resolved through the active bridge selection strategy.
Declaration
float GetGamepadRightTrigger()
Returns
| Type | Description |
|---|---|
| float | A value in [0, 1] where 0 is fully released and 1 is fully pressed; |
GetLastUsedDevice()
Returns the most recently used input device as reported by the active bridge.
Declaration
InputDevice GetLastUsedDevice()
Returns
| Type | Description |
|---|---|
| InputDevice | The UnityEngine.InputSystem.InputDevice that last produced input, or |
GetMouseDelta()
Returns the per-frame mouse movement delta, resolved through the active bridge selection strategy.
Declaration
Vector2 GetMouseDelta()
Returns
| Type | Description |
|---|---|
| Vector2 | Mouse displacement in pixels; UnityEngine.Vector2.zero if the mouse did not move or no mouse is available. |
GetMousePosition()
Returns the current mouse cursor position in screen-space pixel coordinates, resolved through the active bridge selection strategy.
Declaration
Vector2 GetMousePosition()
Returns
| Type | Description |
|---|---|
| Vector2 | Mouse position as a UnityEngine.Vector2 with (0, 0) at the bottom-left; UnityEngine.Vector2.zero if no mouse is connected or no bridges are registered. |
GetMouseScrollDelta()
Returns the scroll wheel delta for the current frame, resolved through the active bridge selection strategy.
Declaration
Vector2 GetMouseScrollDelta()
Returns
| Type | Description |
|---|---|
| Vector2 | Scroll delta where |
HasBridge(string)
Returns whether a bridge with the given ID is currently registered.
Declaration
bool HasBridge(string bridgeID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bridgeID | The BridgeID to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
HasBridgeForInputType(InputDeviceType)
Returns whether a per-input-type bridge assignment exists for the given device category.
Declaration
bool HasBridgeForInputType(InputDeviceType inputType)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDeviceType | inputType | The InputDeviceType to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
Initialize()
Initializes the manager and calls Initialize() on every currently registered bridge.
Declaration
void Initialize()
Remarks
Bridges registered after this call are initialized immediately upon registration. Calling Initialize() more than once without an intervening Shutdown() is a no-op that emits a warning.
IsAnyKeyPressed()
Returns whether any keyboard key is currently held down, resolved through the active bridge selection strategy.
Declaration
bool IsAnyKeyPressed()
Returns
| Type | Description |
|---|---|
| bool |
|
IsGamepadButtonPressed(GamepadButton)
Returns whether the specified gamepad button is currently held down, resolved through the active bridge selection strategy.
Declaration
bool IsGamepadButtonPressed(GamepadButton button)
Parameters
| Type | Name | Description |
|---|---|---|
| GamepadButton | button | The gamepad button to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsGamepadConnected()
Returns whether at least one gamepad is currently connected, resolved through the active bridge selection strategy.
Declaration
bool IsGamepadConnected()
Returns
| Type | Description |
|---|---|
| bool |
|
IsKeyPressed(Key)
Returns whether the specified keyboard key is currently held down, resolved through the active bridge selection strategy.
Declaration
bool IsKeyPressed(Key key)
Parameters
| Type | Name | Description |
|---|---|---|
| Key | key | The key to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsMouseButtonPressed(int)
Returns whether the specified mouse button is currently held down, resolved through the active bridge selection strategy.
Declaration
bool IsMouseButtonPressed(int button)
Parameters
| Type | Name | Description |
|---|---|---|
| int | button | Zero-based index: 0 = left, 1 = right, 2 = middle, 3 = forward, 4 = back. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsMouseConnected()
Returns whether a mouse device is currently connected, resolved through the active bridge selection strategy.
Declaration
bool IsMouseConnected()
Returns
| Type | Description |
|---|---|
| bool |
|
RegisterBridge(IScyllaInputBridge)
Registers a bridge with the manager and immediately incorporates it into input query routing.
Declaration
void RegisterBridge(IScyllaInputBridge bridge)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaInputBridge | bridge | The bridge to register. Must not be |
Remarks
If the manager has already been initialized when this method is called, the new bridge is initialized immediately. The internal priority list is re-sorted after registration so that the bridge is consulted in the correct order.
SetBridgeForInputType(InputDeviceType, string)
Designates a specific bridge to handle all queries for a given input device type when QueryMode is PerInputType.
Declaration
void SetBridgeForInputType(InputDeviceType inputType, string bridgeID)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDeviceType | inputType | The InputDeviceType category (e.g., Gamepad) for which the routing assignment should apply. |
| string | bridgeID | The BridgeID of the bridge that should service
queries for |
SetBridgePriority(string, int)
Overrides the priority of a registered bridge and re-sorts the bridge list.
Declaration
void SetBridgePriority(string bridgeID, int priority)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bridgeID | The BridgeID of the bridge to update. If the ID is not found, the call is a no-op with a warning. |
| int | priority | The new priority value. Higher values cause the bridge to be consulted before bridges with lower values. There is no enforced range; any integer is valid. |
Remarks
This override is stored separately from the bridge's own Priority property. The override takes precedence over the bridge's native priority for the lifetime of this manager.
Shutdown()
Shuts down the manager, calling Shutdown() on every registered bridge and clearing all internal state.
Declaration
void Shutdown()
Remarks
After shutdown, all bridge registrations, priority overrides, and per-input-type routing assignments are discarded. The manager can be re-initialized by calling Initialize() again.
UnregisterBridge(string)
Unregisters the bridge with the given ID, shutting it down and removing it from all routing tables.
Declaration
void UnregisterBridge(string bridgeID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bridgeID | The BridgeID of the bridge to remove. If no bridge with this ID is registered, the call is a no-op with a warning. |
Remarks
The bridge's Shutdown() is called before removal. Any per-input-type routing assignments that reference this bridge ID remain in the routing table but will resolve to the ActiveBridge at query time until reassigned or cleared.
Update()
Advances per-frame state in all available bridges. Must be called once per frame.
Declaration
void Update()
Remarks
Only bridges where IsAvailable is true
receive the Update() call. Bridges that report
unavailable are silently skipped.
WasGamepadButtonPressedThisFrame(GamepadButton)
Returns whether the specified gamepad button transitioned to pressed this frame, resolved through the active bridge selection strategy.
Declaration
bool WasGamepadButtonPressedThisFrame(GamepadButton button)
Parameters
| Type | Name | Description |
|---|---|---|
| GamepadButton | button | The gamepad button to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
WasGamepadButtonReleasedThisFrame(GamepadButton)
Returns whether the specified gamepad button transitioned to released this frame, resolved through the active bridge selection strategy.
Declaration
bool WasGamepadButtonReleasedThisFrame(GamepadButton button)
Parameters
| Type | Name | Description |
|---|---|---|
| GamepadButton | button | The gamepad button to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
WasKeyPressedThisFrame(Key)
Returns whether the specified keyboard key transitioned to pressed this frame, resolved through the active bridge selection strategy.
Declaration
bool WasKeyPressedThisFrame(Key key)
Parameters
| Type | Name | Description |
|---|---|---|
| Key | key | The key to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
WasKeyReleasedThisFrame(Key)
Returns whether the specified keyboard key transitioned to released this frame, resolved through the active bridge selection strategy.
Declaration
bool WasKeyReleasedThisFrame(Key key)
Parameters
| Type | Name | Description |
|---|---|---|
| Key | key | The key to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
WasMouseButtonPressedThisFrame(int)
Returns whether the specified mouse button transitioned to pressed this frame, resolved through the active bridge selection strategy.
Declaration
bool WasMouseButtonPressedThisFrame(int button)
Parameters
| Type | Name | Description |
|---|---|---|
| int | button | Zero-based index: 0 = left, 1 = right, 2 = middle, 3 = forward, 4 = back. |
Returns
| Type | Description |
|---|---|
| bool |
|
WasMouseButtonReleasedThisFrame(int)
Returns whether the specified mouse button transitioned to released this frame, resolved through the active bridge selection strategy.
Declaration
bool WasMouseButtonReleasedThisFrame(int button)
Parameters
| Type | Name | Description |
|---|---|---|
| int | button | Zero-based index: 0 = left, 1 = right, 2 = middle, 3 = forward, 4 = back. |
Returns
| Type | Description |
|---|---|
| bool |
|
Events
OnDeviceConnected
Raised when any input device is connected or reconnected through any registered bridge.
Declaration
event Action<InputDevice> OnDeviceConnected
Event Type
| Type | Description |
|---|---|
| Action<InputDevice> |
Remarks
Aggregates OnDeviceConnected events from all registered bridges. Subscribers do not need to monitor individual bridges.
OnDeviceDisconnected
Raised when any input device is disconnected through any registered bridge.
Declaration
event Action<InputDevice> OnDeviceDisconnected
Event Type
| Type | Description |
|---|---|
| Action<InputDevice> |
Remarks
Aggregates OnDeviceDisconnected events from all registered bridges. Subscribers do not need to monitor individual bridges.