Keep Variables When Using Open Level

just like the name says! i have a box collider and when i hit it to restart the level i want to be down a life, but… when i hit it the level just restarts with my stock amount of lives! Pls Help

Hi there,

What you need is the GameInstance.
I guess you know how to handle your own GameMode? There is no difference in usage of the GameInstance.

  1. Create a new Blueprint class and select “GameInstance” as parent class. Call it (e.g.) “MyGameInstance” or so.
  2. Put your Variables (e.g.) “Life” in there.
  3. Now you need to tell the Engine to use your Blueprint: Project Settings → Maps&Modes → And at the bottom you will find the Dropdown where you can select your GameInstance Blueprint.
  4. And here we go: From now on you can access your Life-Variable like this without losing the stored value on level restart:

99876-accessgameinstance.jpg

hope that helps :slight_smile: Marooney

that worked perfect thank you :slight_smile:

You are welcome :slight_smile:
Please check the answer as solved (on the left side below the arrows) to close this question for the answerhub-system and for people looking for unanswered questions :slight_smile: Thanks :slight_smile: