Instrictlogic.com
Edit (admin)
Advanced device managment

This manager acts as the central hub for device management, providing access to:


  • Device connection events
  • Device disconnection events
  • Device selection events
  • Current selected device


Think of it as the device controller for the whole system.



1. Get Input Manager

The system begins by retrieving the Input Manager instance.

Node


Get WM Input Manager

This manager acts as the central hub for device management, providing access to:


  • Device connection events
  • Device disconnection events
  • Device selection events
  • Current selected device

Think of it as the device controller for the whole system.


2. Binding Device Events

Instead of polling, we bind functions to manager events.


Device Connected Event

Bind Event To OnDeviceConnected

When a new device is plugged in:


  1. The event fires automatically.
  2. OnDeviceConnected_Event executes.
  3. The connected device reference becomes available.

Typical uses:


  • Show "Controller Connected"
  • Register the device
  • Update UI icons
  • Add controller Widget

Device Disconnected Event

Bind Event To OnDeviceDisconnected

Triggered when a device is removed.

The blueprint then:


Cast To WM_HID_Joystick

This ensures the disconnected device is a Joystick type before using joystick-specific logic.

Typical uses:


  • Remove controller from UI

Device Selected Event

Bind Event To OnDeviceSelected

This event fires when the system changes the active device.

Example situations:


  • Used with device configuration UI
  • User select device from list and it becomes active device to configure

Again the device is cast to:


WM_HID_Joystick

so joystick features can be accessed.


3. Getting Current Device Anytime

You can query the manager anytime.


GetSelectedDevice

Get Selected Device

Returns:


HIDDevice (base class)

This is the generic device interface.


GetSelectedJoystick

Get Selected Joystick

Returns:


WM_HID_Joystick

which contains joystick-specific data like:


  • axes
  • buttons
  • hats
  • trigger states

4. Checking Device Validity

Before using the selected device you check:


Is Valid

This prevents runtime errors when:


  • no controller is connected
  • a device was unplugged

5. Detecting Key Type

Finally the blueprint queries input type:


Get_HidJoystickKeyType

Then switches:


Switch on WM_GamepadKeyType

Possible results:


  • Axis
  • Button
  • DPad
  • No Gamepad Key

This allows the system to process inputs differently depending on their type.


Why Event Binding Is Better

Instead of:


Tick → Check Devices → Compare → Update

you get:


Device event happens → Event fires → Handle instantly

Advantages:


  • 🚀 No per-frame polling
  • Immediate reaction
  • 🧠 Cleaner logic
  • 🔋 Lower CPU usage