Saving & Loading


Firsly let’s take a look at save game blueprint (DCSSaveGame).

This blueprint has only few variables which will be used to store the saved data.


DCSGameMode has 2 functions for loading / saving and 2 event dispatchers OnGameLoaded & OnGameSaved which are called when game is loaded or saved.

  • LoadGame loads data from save game file (if exist) and retrieves its variables
  • SaveGame firstly it retrieves data that should be saved from components (inventory / equipment / stats etc.), then saves it to save game file (creates it if doesn’t exist)

When game starts (BeginPlay) game mode updates its data to make sure it’s correct in case save game file doesn’t exist.
Then it waits 1 frame before loading / saving to make sure that BeginPlay event of components will be called first.


As example let’s take a look at InventoryComponent.

On BeginPlay, if owner is a player, it binds event to dispatcher OnGameLoaded.
This is why game mode has 1 frame delay before loading / saving, because otherwise this binding would happen after loading / saving, and binded event wouln’t be called on BeginPlay.
From now on, whenever game is loaded, InventoryComponent will rebuild its inventory.