Sending variables between levels.

Hi, i’m currently working on a game which is built up of 4 different levels and one main central hub area which is used to travel between the different levels. The 4 levels and the central hub are split into their own levels which are loaded and unloaded and the player walks between the areas.
But i’m a bit stuck with the progression that will occur when the players play the game, i want to stop the player from playing levels which before completing the levels prior to that level (The player completes the level by activating a certain object in the level). I will have doors that will stop the player but i need the game to know if the player has beaten a level or not.

I’m currently wondering if there is a way to keep the bools that are connected to the player having beaten a level or not global in some way so that the object the player needs to activate to win could change the bool that correspond the correct level. The central hub also needs to be able to check these bools to see what doors that should open and which should not.

I guess you could also send the bool to the central hub, but since the central hub wont be loaded at the same time a player completes a level i’m a bit unsure how you would do this.

I guess you are using LoadMap to travel between hub level and other levels? Right now there is no good way to sore state between LoadMap calls, since all your objects get destroyed between map traveling. One way is to write your game state to a file.

But did you consider to use streaming levels instead? Hub level and 4 other levels, could be a streaming levels, that should be streamed in/out by game requests.
In this case you can store game state in the persistent level which will not get destroyed while game is running.
And you can control streaming levels state using “Get Streaming Level” node in BP.

Yeah, i should have mentioned that i’m currently using streaming level. Storing it in the persistent level might work for my game actually. Thanks, i’ll give it a shot!

Although, how would i go about sending the information that the player has won the level from the object that will be activated by the player to the persistent blueprint?

You can access any actor in the persistent level from a streaming levels. So you can create a BP actor with variables you need and place it in the persistent level.

I think BP made from a GameState actor is a right choice to store your state in. You can access GameState BP from anywhere by using “Get Game State” BP node.

Nvm, figured it out.