Switching Level in the Menu without leaving the menu

Hello there!
I have a Menu in my game with some sliders and Buttons. Right now I switch the level with ‘open level’. The problem is, that this command removes my widget and when I reopen it, the sliders are back in there original position even though I changed their value before opening an oather level.

Is there a way to switch between levels while keeping the menu intact and untouched?

Best wishes
Stefan F

When you’re switching between levels, the widget will get destroyed. So as you’ve already noticed, the values are reset to default since a new widget is being created. However, you can store the main menu slider info before opening a new level, to retrieve them later & set the default values for the sliders when you go back to main menu again.

This can be done in two ways depending upon whether you want the values to remain the same across multiple sessions (quitting and restarting) of the game vs just your current game session.

If you want the values to remain even after quitting & restarting the game, then you can use the **SaveGame **object to store info in your hard drive.

If on the other hand, it’s only relevant within the current session, the **GameInstance **class is your friend since it will not get destroyed when you switch between levels. As a result, any values stored here (say for example the slider percent) will be available for you to access even after you leave the main menu & return to it later.

All right, not the answer I wanted but good to know that this idea doesnt Work. In that case I might try to put all my levels into one and just teleport from one position to anoather. I hope that in this case my widget wont disappear.

All you have to do is create a few variables in the a custom game instance or save game and it’ll work like Stormrage said. Real EZ

Hey there!

Are you doing this to change the scenery of each menu? i.e. a different backdrop for multiplayer, singleplayer, settings, etc? If so this is likely your best bet. You can switch cameras through your level blueprint on your menu map. This is what I’m doing on a project of mine to switch scenery depending on if you’re customizing the character or going through more text oriented menus. =)

Hey there, I should have answered earlier. Saving the the variables and opening the widget automatically after switching the level was the right solution, thanks to everyone of you for helping me!