How to make back handler work, using "Common UI" plugin tutorial

Because it was actually hard to figure out why the BackHandler doesn’t work in Common UI plugin I decided to store all the information that we found and that helped us to make it work

  1. Widget that has common activatable widget stack component should not be Activatable widget but rather CommonWidget.

  2. Create Custom GameViewportClient with DefaultConstructor in your project and set it as default in project settings in GameViewportClientClass.

// .h
UCLASS()
class YOURGAME_API UMyGameViewportClient : public UCommonGameViewportClient
{
    GENERATED_BODY()

    UMyGameViewportClient();
};
// .cpp
UMyGameViewportClient::UMyGameViewportClient() : Super()
{
	OnRerouteInput().BindUObject(this, &UCommonGameViewportClient::HandleRerouteInput);
	OnRerouteAxis().BindUObject(this, &UCommonGameViewportClient::HandleRerouteAxis);
	OnRerouteTouch().BindUObject(this, &UCommonGameViewportClient::HandleRerouteTouch);
}


  1. Check “Is back Handler” on activatable widget.
  2. Check “Is Modal” on activatable widget.
  3. override OnHandleBackAction inside your activatable widget and put print string to test.
  4. override Get Desired Focus Target inside your activatable widget.
1 Like