Click the empty space on the menu triggers mouse click event in other class

Try to use UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx. It’s in #include "Blueprint/WidgetBlueprintLibrary.h".

UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(PlayerControllerToSet, WidgetToFocus, MouseLockMode);

But remember, if you want to return a control of your player pawn, use UWidgetBlueprintLibrary::SetInputMode_GameOnly.

UWidgetBlueprintLibrary::SetInputMode_GameOnly(PlayerControllerToSet);
2 Likes