I added c++ code like that :
#pragma once
#include "Engine/GameViewportClient.h"
#include "MyGameViewportClient.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLostFocusSignature);
/**
* UMyGameViewportClient class.
*/
UCLASS()
class GAME_API UMyGameViewportClient : public UGameViewportClient
{
GENERATED_BODY()
public:
// Lost focus event.
UPROPERTY(BlueprintAssignable, Category="LostFocus")
FLostFocusSignature OnLostFocus;
// Override lost focus function.
virtual void LostFocus(FViewport* Viewport) override;
};
#include "Game.h"
#include "MyGameViewportClient.h"
void UMyGameViewportClient::LostFocus(FViewport* Viewport)
{
UGameViewportClient::LostFocus(Viewport);
OnLostFocus.Broadcast();
}
The problem is I don’t see the event in my game mode blueprint to call a pause game and show a pause menu, and I don’t find a node in blueprint to get the game viewport (maybe not possible). Is it possible to have a global event spawned to have access in game mode blueprint ?