Download

Saving variables between maps

Hi, do you know how to properly save and load variables between levels ?
So I have only one variable that I want to save and that’s “current level”.

In my game instance i have on event init already audio system connected and on my level 2 on begin play I already connected player start nodes.

I was trying to search for a solution on google, but everyone has some event on clicked, so it’s not the similiar project. I just want to pass variables from level 1 to level 2 etc…

For example, im level 1 on the first map and after I kill some enemies I lvp up to level 2, but when I enter in portal that teleports me to another level (in this case, map 2), all of those experience I earned on level 1 (map 1) are lost and im level 1 again.

I will post some pictures now so you can see.

to save: get game instance → cast to DoorInstance → set XP Current

then when starting the next level do the same thing but “get XP Current” in the player’s Construct or where ever the XP is being used.

game instances are consistent the whole time the game is running and are not reset by changing level. they are a tier above the game mode or levels. so just add any variables you want to carry over to that blueprint and you can access them whenever you want and they will only change when you tell them to