I’m writing an input prompt UI for showing the correct gamepad/keyboard glyphs. An important part here is to know whenever player changes their input device (e.g. plugging a gamepad).
This example works in Windows:
void UInputPromptUi::NativeConstruct()
{
Super::NativeConstruct();
.....
const FPlatformUserId PlatformUserId = GetOwningPlayerPawn()->GetPlatformUserId();
UpdatePlayerDeviceType(PlatformUserId);
UInputDeviceSubsystem* InputDeviceSubsystem = GetGameInstance()->GetEngine()->GetEngineSubsystem<UInputDeviceSubsystem>();
//Binding my own function to the event in InputDeviceSubsystem
InputDeviceSubsystem->OnInputHardwareDeviceChanged.AddUniqueDynamic(this, &UInputPromptUi::OnInputHardwareDeviceChanged);
}
void UInputPromptUi::OnInputHardwareDeviceChanged(const FPlatformUserId UserId, const FInputDeviceId InputDeviceId)
{
//My own function that handles the input hardware change
UpdatePlayerDeviceType(UserId);
}
… but it doesn’t in Mac. Plugging and unplugging my gamepads doesn’t fire the OnInputHardwareDeviceChanged event. I tried both with XBox and DualSense. My Macbook is macOS 15.5.