Inheritance is the second way to implement a custom Actor. This is commonly done to make a new subclass, which adds member variables, functions, or a Component to an existing Actor class. In this recipe, we are going to add a variable to a custom GameState subclass.
Implementing the Actor functionality by inheritance
How to do it...
- In the Unreal Editor, click on Add New in the Content Browser. Then, in New C++ Class..., select Game State Base as the base class, and give your new class a name (I'll be using the default MyGameStateBase by creating the AMyGameStateBase class):
The GameState class is responsible for information that is meant to be shared by all players and is specific to the Game Mode, but is not specific...