Game Mode, Player State, and Game State
So far, we've covered most of the important classes in the gameplay framework, including the game mode, player controller, and the pawn. In this chapter, we're going to cover the player state, game state, and some additional concepts of the game mode, as well as some useful built-in functionalities.
Game Mode
We've already talked about the game mode and how it works, but there are a few concepts that haven't yet been covered.
Constructor
To set the default class values, you can use the constructor like so:
ATestGameMode::ATestGameMode() { DefaultPawnClass = AMyCharacter::StaticClass(); PlayerControllerClass = AMyPlayerController::StaticClass(); PlayerStateClass = AMyPlayerState::StaticClass(); GameStateClass = AMyGameState::StaticClass(); }
The preceding code lets you specify which classes to use when spawning pawns, player controllers, player states, and game...