The UVK::GameMode class is entirely owned by a level and contains pointers to a Game State, Player State and a `Player Controller


  1. Generate a game mode using the Build Tool (for this example it’s going to be called GM)
  2. Include the game mode header into your level’s header
  3. In the constructor call, add the following line with the type of your game mode class as a template argument:
    gameMode = GameMode::makeGameMode<GM>();
  4. You have a game mode for your level


To use the game mode’s events in your level, call the void beginAutohandle(), void tickAutohandle(float deltaTime) and void endAutohandle() in their respective functions void beginPlay(), void tick(float deltaTime), void endPlay(). This will call all the game mode’s events when one of those events is triggered.

Semantically, the game mode should be used to store the rules of the game and possibly manage them

The game mode class provides a static Pawn* getPawn(GameMode* gameMode) function to easily access the pawn without navigating down the hierarchy


The game mode owns pointers to a GameState, PlayerState and a PlayerController. The same “autohandle” events apply here to call the events of all these classes.


You can use the standard cast function to cast a pointer to a game mode to its original type, like this

gameMode = GameMode::makeGameMode<GM>();
auto* a = GameMode::cast<GM>(gameMode);