Game

And now we have a game

Game Instance

GameInstance is created when the game is launched and persists until the game is shutdown. Used for things that should keep working across level changes such as network or game settings.


  • Access C++: GetWorld()->GetGameInstance<>() or Actor->GetGameInstance().

  • Access BP: GetGameInstance


Game Mode

The GameMode is created when a level is loaded. It's purpose is to be the where you write the game rules for your game. It specify wich classes to use for other framework objects such as the PlayerController, Pawn, HUd, GameState and PlayerState. You can set the default GameMode for all levels in settings and then costimize it for specific levels.

There are two GameMode classes to use, GameModeBase and GameMode. GameMode is a subclass of GameModeBase and contains features that can be useful in a online game. You can choose the one to base your GameMode on depending on the type of game you make. Whatever you choose a GameMode only exist on the server in a multiplayer game.

  • Access C++: World->GameState<>() or GameMode::GetGameState on server.


    • InitGame

    • PreLogin

    • PostLogin

    • HandleStartingNewPlayer

    • RestartPlayer

    • SpawnDefaultPawnAtTransform

    • Logout


Game State

The GameState is where you store data that all players in a multiplayer game need to be aware of of. It is replicated to all the clients in the game.

  • Access C++: World->GameState<>() or GameMode::GetGameState on server.