How to save a variable?

In Project Settings “Project - Maps and Modes” you can create a new GameInstance class. The GameInstance persists between levels until you quit the game.