Class InputDeviceUtil
Provides centralized helpers for classifying Unity Input System devices and binding path strings into InputDeviceType categories, avoiding duplicated type-switch logic across the Input module's internal managers.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public static class InputDeviceUtil
Remarks
All methods are stateless and allocation-free (except
GetDeviceTypeFromPath(string), which calls
string.ToLowerInvariant() to normalize the path before inspection).
They are safe to call from any thread.
The classification methods use Unity's Input System type hierarchy. A
Gamepad check catches all controllers that derive from
UnityEngine.InputSystem.Gamepad (XInput, DualShock, etc.).
Joysticks that do not extend Gamepad are classified separately as
Joystick.
Methods
GetDeviceType(InputDevice)
Determines the InputDeviceType category for the given Unity Input
System InputDevice instance by inspecting its runtime type.
Declaration
public static InputDeviceType GetDeviceType(InputDevice device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDevice | device | The device to classify. May be |
Returns
| Type | Description |
|---|---|
| InputDeviceType | The InputDeviceType that best describes the device. Returns
Unknown when |
GetDeviceTypeFromPath(string)
Determines the InputDeviceType category for the device identified
in a Unity Input System binding path string such as
<Keyboard>/space or <Gamepad>/buttonSouth.
Declaration
public static InputDeviceType GetDeviceTypeFromPath(string bindingPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bindingPath | A Unity Input System binding path string. The method inspects the
device-layout component enclosed in angle brackets at the start of the path
(e.g., |
Returns
| Type | Description |
|---|---|
| InputDeviceType | The InputDeviceType that corresponds to the device layout named
in the path. Returns Unknown when
|
Remarks
The comparison is case-insensitive: the path is converted to lowercase with
string.ToLowerInvariant() before the device-token substring checks are
applied. Gamepad paths produced by XInput (<XInputController>) and
PlayStation controllers (<DualShockGamepad>) are both mapped to
Gamepad.
IsGamepadOrJoystick(InputDevice)
Returns true when the given device is a gamepad or a joystick - the two
controller categories that represent hands-on analog input hardware.
Declaration
public static bool IsGamepadOrJoystick(InputDevice device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDevice | device | The device to test. May be |
Returns
| Type | Description |
|---|---|
| bool |
|
IsKeyboardOrMouse(InputDevice)
Returns true when the given device is a keyboard or a mouse - the two
devices that together form the standard desktop input pair.
Declaration
public static bool IsKeyboardOrMouse(InputDevice device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDevice | device | The device to test. May be |
Returns
| Type | Description |
|---|---|
| bool |
|
IsTouchDevice(InputDevice)
Returns true when the given device is a pointer-contact input device,
meaning it reports input via direct surface contact rather than buttons or
analog axes. This covers touchscreens and pen/stylus devices.
Declaration
public static bool IsTouchDevice(InputDevice device)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDevice | device | The device to test. May be |
Returns
| Type | Description |
|---|---|
| bool |
|