Event Destroyed run when level opened by a script begins play

In my game, I use a main menu level that displays a widget blueprint on screen, and I open a level when somebody hits play. I also have a death script, where if the player dies then put a respawn button on their screen. When I start the level, it immediately shows me the death screen. Why?


I managed to reproduce your issue. When you’re moving to a new level, Engine destroys all Actors in your current level, that is also your default Pawn spawned in the first Level, with Main Menu. The Destroy event is called on the first Level and new Widget is added to the Viewport. This Widget then travels to the second Level and that’s why you can see it there.

I would fix this problem by creating separate Game Mode specific for the Main Menu Level. In this Game Mode, I would set Default Pawn to None so no Player Pawn is created there. In this way, there is no Actor to be destroyed so your logic connected to Destroy Event won’t be executed. You could still detect the Player’s input because Player Controller will be spawned by the Engine.

Another way is just to check if the Player Pawn has no HP when the Event Destroyed is called.