- Create a new C++ class, like in the previous recipe. This time, select Game Mode Base as your base class:
- Once you have clicked Next, give the new class a name, such as UE4CookbookGameModeBase.
- Declare a function override in the .h file of your new GameModeBase class:
#pragma once#include "CoreMinimal.h"#include "GameFramework/GameModeBase.h"#include "UECookbookGameModeBase.generated.h"/** * */UCLASS()class CHAPTER_04_API AUECookbookGameModeBase : public AGameModeBase{ GENERATED_BODY()public: virtual void BeginPlay() override; };
- Implement the BeginPlay function in the .cpp file:
#include "UECookbookGameModeBase.h" ...