InControl API Reference
InputManager Class Reference

Static Public Member Functions

static void Setup ()
 DEPRECATED: Use the InControlManager component instead. More...
 
static void Reset ()
 DEPRECATED: Use the InControlManager component instead. More...
 
static void Update ()
 DEPRECATED: Use the InControlManager component instead. More...
 
static void Reload ()
 Force the input manager to reset and setup. More...
 
static void ClearInputState ()
 Clears the state of input on all controls. The net result here should be that the state on all controls will return zero/false for the remainder of the current tick, and during the next update tick WasPressed, WasReleased, WasRepeated and HasChanged will return false. More...
 
static void AddDeviceManager (InputDeviceManager deviceManager)
 Adds a device manager. Only one instance of a given type can be added. An error will be raised if you try to add more than one. More...
 
static void AddDeviceManager< T > ()
 Adds a device manager by type. More...
 
static T GetDeviceManager< T > ()
 Get a device manager from the input manager by type if it one is present. More...
 
static bool HasDeviceManager< T > ()
 Query whether a device manager is present by type. More...
 
static void AttachDevice (InputDevice inputDevice)
 Attach a device to the input manager. More...
 
static void DetachDevice (InputDevice inputDevice)
 Detach a device from the input manager. More...
 
static void HideDevicesWithProfile (Type type)
 Hides the devices with a given profile. This must be called before the input manager is initialized. More...
 

Static Public Attributes

static readonly VersionInfo Version = VersionInfo.InControlVersion()
 
static ReadOnlyCollection< InputDeviceDevices
 A readonly collection of devices. Not every device in this list is guaranteed to be attached or even a controller. This collection should be treated as a pool from which devices may be selected. The collection is in no particular order and the order may change at any time. Do not treat this collection as a list of players. More...
 

Properties

static bool CommandWasPressed [get]
 Query whether a command button was pressed on any device during the last frame of input. More...
 
static bool InvertYAxis [get, set]
 Gets or sets a value indicating whether the Y axis should be inverted for two-axis (directional) controls. When false (default), the Y axis will be positive up, the same as Unity. More...
 
static bool IsSetup [get]
 Gets a value indicating whether the InputManager is currently setup and running. More...
 
static bool MenuWasPressed [get]
 
static bool AnyKeyIsPressed [get]
 Detects whether any (keyboard) key is currently pressed. For more flexibility, see KeyCombo.Detect() More...
 
static InputDevice ActiveDevice [get]
 Gets the currently active device if present, otherwise returns a null device which does nothing. The currently active device is defined as the last device that provided input events. This is a good way to query for a device in single player applications. More...
 
static bool Enabled [get, set]
 Toggle whether input is processed or not. While disabled, all controls will return zero state. More...
 
static bool SuspendInBackground [get, set]
 Suspend input updates when the application loses focus. When enabled and the app loses focus, input will be cleared and no. input updates will be processed. Input updates will resume when the app regains focus. More...
 
static bool EnableNativeInput [get, set]
 Enable Native Input support. When enabled on initialization, the input manager will first check whether Native Input is supported on this platform and if so, it will add a NativeInputDeviceManager. More...
 
static bool EnableXInput [get, set]
 Enable XInput support (Windows only). When enabled on initialization, the input manager will first check whether XInput is supported on this platform and if so, it will add an XInputDeviceManager. More...
 
static uint XInputUpdateRate [get, set]
 Set the XInput background thread polling rate. When set to zero (default) it will equal the projects fixed updated rate. More...
 
static uint XInputBufferSize [get, set]
 Set the XInput buffer size. (Experimental) Usually you want this to be zero (default). Setting it higher will introduce latency, but may smooth out input if querying input on FixedUpdate, which tends to cluster calls at the end of a frame. More...
 
static bool NativeInputEnableXInput [get, set]
 Set Native Input on Windows to use XInput. When set to true (default), XInput will be utilized which better supports compatible controllers (such as Xbox 360 and Xbox One gamepads) including vibration control and proper separated triggers, but limits the number of these controllers to four. Additional XInput-compatible beyond four controllers will be ignored. DirectInput will be used for all non-XInput-compatible controllers. More...
 
static bool NativeInputPreventSleep [get, set]
 Set Native Input to prevent system sleep and screensaver. Controller input generally does not prevent the system idle timer and the screensaver may come on during extended gameplay. When set to true, this will be prevented. More...
 
static uint NativeInputUpdateRate [get, set]
 Set the Native Input background thread polling rate. When set to zero (default) it will equal the project's fixed update rate. More...
 
static bool EnableICade [get, set]
 Enable iCade support (iOS only). When enabled on initialization, the input manager will first check whether XInput is supported on this platform and if so, it will add an XInputDeviceManager. More...
 

Events

static Action OnSetup
 
static Action< ulong, float > OnUpdate
 
static Action OnReset
 
static Action< InputDeviceOnDeviceAttached
 
static Action< InputDeviceOnDeviceDetached
 
static Action< InputDeviceOnActiveDeviceChanged
 

Member Function Documentation

static void AddDeviceManager ( InputDeviceManager  deviceManager)
static

Adds a device manager. Only one instance of a given type can be added. An error will be raised if you try to add more than one.

Parameters
deviceManagerThe device manager to add.
static void AddDeviceManager< T > ( )
static

Adds a device manager by type.

Template Parameters
TA subclass of InputDeviceManager.
Type Constraints
T :InputDeviceManager 
T :new() 
static void AttachDevice ( InputDevice  inputDevice)
static

Attach a device to the input manager.

Parameters
inputDeviceThe input device to attach.
static void ClearInputState ( )
static

Clears the state of input on all controls. The net result here should be that the state on all controls will return zero/false for the remainder of the current tick, and during the next update tick WasPressed, WasReleased, WasRepeated and HasChanged will return false.

static void DetachDevice ( InputDevice  inputDevice)
static

Detach a device from the input manager.

Parameters
inputDeviceThe input device to attach.
static T GetDeviceManager< T > ( )
static

Get a device manager from the input manager by type if it one is present.

Template Parameters
TA subclass of InputDeviceManager.
Type Constraints
T :InputDeviceManager 
static bool HasDeviceManager< T > ( )
static

Query whether a device manager is present by type.

Template Parameters
TA subclass of InputDeviceManager.
Type Constraints
T :InputDeviceManager 
static void HideDevicesWithProfile ( Type  type)
static

Hides the devices with a given profile. This must be called before the input manager is initialized.

Parameters
typeType.
static void Reload ( )
static

Force the input manager to reset and setup.

static void Reset ( )
static

DEPRECATED: Use the InControlManager component instead.

Deprecated:
Calling this method directly is no longer supported. Use the InControlManager component to manage the lifecycle of the input manager instead.
static void Setup ( )
static

DEPRECATED: Use the InControlManager component instead.

Deprecated:
Calling this method directly is no longer supported. Use the InControlManager component to manage the lifecycle of the input manager instead.
static void Update ( )
static

DEPRECATED: Use the InControlManager component instead.

Deprecated:
Calling this method directly is no longer supported. Use the InControlManager component to manage the lifecycle of the input manager instead.

Member Data Documentation

ReadOnlyCollection<InputDevice> Devices
static

A readonly collection of devices. Not every device in this list is guaranteed to be attached or even a controller. This collection should be treated as a pool from which devices may be selected. The collection is in no particular order and the order may change at any time. Do not treat this collection as a list of players.

Property Documentation

InputDevice ActiveDevice
staticget

Gets the currently active device if present, otherwise returns a null device which does nothing. The currently active device is defined as the last device that provided input events. This is a good way to query for a device in single player applications.

bool AnyKeyIsPressed
staticget

Detects whether any (keyboard) key is currently pressed. For more flexibility, see KeyCombo.Detect()

bool CommandWasPressed
staticget

Query whether a command button was pressed on any device during the last frame of input.

bool Enabled
staticgetset

Toggle whether input is processed or not. While disabled, all controls will return zero state.

bool EnableICade
staticgetset

Enable iCade support (iOS only). When enabled on initialization, the input manager will first check whether XInput is supported on this platform and if so, it will add an XInputDeviceManager.

bool EnableNativeInput
staticgetset

Enable Native Input support. When enabled on initialization, the input manager will first check whether Native Input is supported on this platform and if so, it will add a NativeInputDeviceManager.

bool EnableXInput
staticgetset

Enable XInput support (Windows only). When enabled on initialization, the input manager will first check whether XInput is supported on this platform and if so, it will add an XInputDeviceManager.

bool InvertYAxis
staticgetset

Gets or sets a value indicating whether the Y axis should be inverted for two-axis (directional) controls. When false (default), the Y axis will be positive up, the same as Unity.

bool IsSetup
staticget

Gets a value indicating whether the InputManager is currently setup and running.

bool NativeInputEnableXInput
staticgetset

Set Native Input on Windows to use XInput. When set to true (default), XInput will be utilized which better supports compatible controllers (such as Xbox 360 and Xbox One gamepads) including vibration control and proper separated triggers, but limits the number of these controllers to four. Additional XInput-compatible beyond four controllers will be ignored. DirectInput will be used for all non-XInput-compatible controllers.

bool NativeInputPreventSleep
staticgetset

Set Native Input to prevent system sleep and screensaver. Controller input generally does not prevent the system idle timer and the screensaver may come on during extended gameplay. When set to true, this will be prevented.

uint NativeInputUpdateRate
staticgetset

Set the Native Input background thread polling rate. When set to zero (default) it will equal the project's fixed update rate.

bool SuspendInBackground
staticgetset

Suspend input updates when the application loses focus. When enabled and the app loses focus, input will be cleared and no. input updates will be processed. Input updates will resume when the app regains focus.

uint XInputBufferSize
staticgetset

Set the XInput buffer size. (Experimental) Usually you want this to be zero (default). Setting it higher will introduce latency, but may smooth out input if querying input on FixedUpdate, which tends to cluster calls at the end of a frame.

uint XInputUpdateRate
staticgetset

Set the XInput background thread polling rate. When set to zero (default) it will equal the projects fixed updated rate.


The documentation for this class was generated from the following file: