For this recipe, you'll need to have an Actor subclass ready to instantiate. You can use a built-in class such as StaticMeshActor, but it would help to practice with the custom Actor you made in the previous recipe.
Instantiating an Actor using SpawnActor
How to do it...
- Create a new C++ class, like in the previous recipe. This time, select Game Mode Base as your base class:
![](https://static.packt-cdn.com/products/9781789809503/graphics/assets/f59f3973-6781-406c-be4b-1525e29de708.png)
- 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...