How to run the level blueprint code when opening a new level?

Hi, I’m working on the Main Menu for my project using UMG. I have one empty level that I used for my main menu and another game level that I want to load when I click on the ‘New Game’ button. When I click on the ‘New Game’ button, I remove the main menu from viewport and use ‘Open Level’ to load my new game level. However I noticed that doing so does not load the level blueprint of the new level. When I load the game level directly from editor, this issue does not crop up. So it’s definitely a result of the transition from my main menu level to the game level. Also this issue seems to be happening only when I run the game in the editor. The game runs fine when I run it in standalone mode.

So I would like to know if there is some way I could load the level blueprint for a new level, when I’m opening the said new level from another level?

We might need more specific info on what you’re trying to do. If your new map has a BeginPlay node, it indeed should always run when that level is loaded. You can’t access any code from another map than the one you’re in as far as I know.

Yes I have a Begin Play node in the game level that I’m trying to load. I have a break point over there to check the code flow. However the level blueprint for this level doesn’t run when I open this level from another level. The level itself is running with all the actors around as I had placed them, and the rest of the player input code are running fine. Only those dependent on the level blueprint don’t run.

As I had mentioned earlier, this issue is present only when I run the game in the editor window, with the main menu level as the starting level. I’m guessing that only the level that was active in the editor viewport prior to launching the game has it’s level blueprint loaded. Any levels that I load subsequently aren’t having their level blueprint loaded.

It seems everything is working fine now, when running in editor as well. I probably made some errors in my previous code when trying to open the game level.