- Create a new GameModeBase subclass called ClickEventGameMode:
- From the ClickEventGameMode.h file, add the following functions and private members to the class:
#pragma once#include "CoreMinimal.h"#include "GameFramework/GameModeBase.h"#include "SlateBasics.h"#include "ClickEventGameMode.generated.h"UCLASS()class CHAPTER_14_API AClickEventGameMode : public AGameModeBase{ GENERATED_BODY() private: TSharedPtr<SVerticalBox> Widget; TSharedPtr<STextBlock> ButtonLabel;public: virtual void BeginPlay() override; FReply ButtonClicked();};
- Within the .cpp file, add the implementation for BeginPlay:
void AClickEventGameMode::BeginPlay() ...