Player variables resetting when a new level is loaded

I have a number of Booleans that are set in my player’s blueprint on a certain level, when I load a new level, they all reset to their default value, which I don’t want. How do I stop this from happening, or is it possible to create global variables (I have not found a way yet)?

Many thanks,

Ehm, i don’t want to spread false information, but i think this is only possible if you use “Seamless Travel” (can be set in the GameMode Blueprint) and if
you add the CharacterBlueprintActor to the Actors that should survive the Levelchange. Otherwise the Players will be respawned new and fresh
each time you change the Level (which is normally intended :P).

Though there is one class that you can use to store Variable between levelchanges. The Class is called “GameInstance”. It is created once only when you
start the Game and will be destroyed if you close it. You can create your own child BP Class of it and set it in the Maps and Node Settings of your Project
at the bottom of the settings, after all the GameMode and DefaultPawnClass settings.

It will survive the level change (:

Thank you very much, I appreciate your help! I’ll give it a try!

Thread is a little bit old but I have a question about the game instance class. In a network game probably each client gets his own game instance, but couldn’t theoretically the player change the value of an variable inside the game instance which then gets send to the server?

For example in my case I have a Lobby game mode which contains different states, pawn etc. and also has its own level. After the player entered his proper account information the map changes and the game mode gets also changed (including the various state classes). However as the player logged in in the previous level and the sql request also contains information about the character name etc. it only exists in the old player state. Therefore I want to first store the character name in the game instance before the map changes and then call the game instance from the new game mode again and read out the value of the stored character name. But at this time the player could just “cheat” and use another character name.

I have also tried to use the Copy properties event from the player state, but when I try to output a simple text from this event in a child of the player state it doesn’t print it on screen. So how does this event work?

Frezer, the clients do not get their own game instance. The server is the boss and the clients do what they are told. There is a very good video series by unreal on creating a multiplayer lobby on youtube or, follow eXi’s link above and read his network compendium pdf.

Thank you very much for your tip, did exactly how you described and it works! Just to add if you want to cast to your BP game instance child you just need to use “Get Game Instance” and it returns Object you need.