After Opening a Level the GetWorld Function brings the wrong level

Hi Everyone.

I’m having some issues when opening a new level into my game, this issue is only caused after I execute a Open Level, and it’s caused by the Following Blueprint script that is run when I want to start a new level in my game.

The thing is that the last node is an C++ node that runs some custom code and it’s supposed to populate the world, but wen I get the Current World in that node and start spawning the actors, they are actually spawned inside the first world the basically they are getting put inside the MaiMenu world.

Here is the code that runs the New Game node:

GEngine->AddOnScreenDebugMessage(-1, 100, FColor::Red, TEXT("New game selected"));

	UWorld* const World = GetWorld();

	GEngine->AddOnScreenDebugMessage(5, 100, FColor::Red, World->GetMapName());

	CurrentPlayState = NewPlayState;

	if (World)

And the screen that contains the name of the loaded level:


I want to know what needs to be done to actually get the new world, the one that would contain the main player, lets say “World2”.

thank you.

Hi everyone, I finally found what was happening, the issue was actually the lack of information by my part pertaining the Engine Work Flow, the Open Level node after it is executed completely in the BP will load the new Map and this triggers the creation of the new game mode that is associated to the Level, so I only needed to change some inner functionality to actually get it to work correctly.

Thanks to everyone.