The primary class that specifies which classes should be spawned and used by the other systems — PlayerController, Pawn, HUD, GameStateBase, PlayerState, and more. It is also where game rules live: a Capture the Flag mode could use it to manage flags; a wave-based shooter to handle wave spawning. It also handles spawning the player.

GameModeBase only exists on the server — no client ever has an instance. To replicate data that clients need, use GameStateBase (or GameStateBase), which exists on all clients and is designed for this purpose.

Hold On

Unreal’s UI and common usage refer to this system generically as “GameMode” — the dropdown in World Settings, blueprint naming conventions, etc.

GameMode is also a class, specifically a subclass of GameModeBase.

Therefore, the answer to “What class is the GameMode?” might be “GameMode” or “GameModeBase”.

Use When

  • You need to set which Pawn or PlayerState class every player spawns with
  • You want to control spawn/respawn behavior
  • You need game-level rules (player limits, pause handling, level transitions)
  • You want to define what happens when players join or leave

How It Works

Class Defaults

A GameMode Blueprint sets these defaults in its Class Defaults:

SettingWhat it does
Default Pawn ClassThe Pawn that spawns for each player (e.g., BP_ThirdPersonCharacter)
Player State ClassThe PlayerState subclass that tracks per-player data
Player Controller ClassThe controller that handles input and owns the Pawn
HUD ClassThe HUD class drawn for each player
Spectator ClassThe Pawn used for spectating players
Game State ClassThe GameStateBase subclass that tracks game-wide replicated data

Subclass: GameMode

GameMode (child of GameModeBase) adds features originally built for Unreal Tournament: MatchState and other shooter-type functionality. Stick to GameModeBase — it has everything you need and nothing more. If you do inherit from GameMode, also inherit your GameState from GameState (not GameStateBase).

Key Functions

FunctionPurpose
InitGameCalled before any other scripts. Initializes parameters and spawns helper classes.
PreLoginAccepts or rejects a player attempting to join. Set ErrorMessage to reject.
PostLoginCalled after successful login. First safe place to call replicated functions on the PlayerController.
HandleStartingNewPlayerCalled after PostLogin. Override in Blueprint to change what happens to a new player. Default: creates a Pawn.
RestartPlayerStarts spawning a player’s Pawn. Variants: RestartPlayerAtPlayerStart, RestartPlayerAtTransform.
SpawnDefaultPawnAtTransformActually spawns the Pawn. Can be overridden in Blueprint.
LogoutCalled when a player leaves or is destroyed.

Match State Machine (GameMode only, not GameModeBase)

For multiplayer games with distinct phases. States flow in order:

  1. EnteringMap — initial state, world not fully initialized
  2. WaitingToStart — actors ticking, players not yet spawned
  3. InProgress — main gameplay, BeginPlay has been called
  4. WaitingPostMatch — game ended, actors still tick, no new players can join
  5. LeavingMap — transferring to a new map
  6. Aborted — failure state (unrecoverable error)

Query with GetMatchState, HasMatchStarted, IsMatchInProgress, HasMatchEnded.

Setting the GameMode

From lowest to highest priority:

  1. Project-wide default — GlobalDefaultGameMode in DefaultEngine.ini (Project Settings → Maps & Modes)
  2. Per-level override — World Settings → GameMode Override in the editor
  3. URL parameter — command-line ?game=MyGameMode
  4. Map prefix — map name prefixes mapped to GameModes in DefaultEngine.ini

Common Patterns

Custom player data (Tutorial 102 pattern): Create a custom GameMode Blueprint. Set its Player State Class to a custom PlayerState that holds a collectable count variable. Assign this GameMode in World Settings. Now every player who joins gets that custom PlayerState automatically.

Timed game with restart: GameMode runs a Set Timer by Event at BeginPlay. When the timer expires, a Custom Event fires that calls Open Level to reload the map.

  • GameStateBase — the replicated GET; holds game-wide data that clients need to see
  • PlayerState — per-player data class; GameMode controls which subclass is used
  • Open Level — commonly called from GameMode to restart or change levels
  • Set Timer by Event — used in GameMode for countdown timers
  • Cast To — needed to access your custom GameMode from other Blueprints

Source