I use FCoreUObjectDelegates::PostLoadMapWithWorld.AddRaw bind with a function and I think it will be executed after I enter "Play" by "VR Preview" Mode,But the function has not been executed

I use FCoreUObjectDelegates::PostLoadMapWithWorld.AddRaw bind with a function and I think it will be executed after I enter “Play” by “VR Preview” Mode,But the function has not been executed.

where u able to solve the issue?

There are a bunch of dead delegates that never get called littered around the source. Happy hunting. Sorry!

I had the same issue, very weird how this delegate isn’t called. But there’s another way that’s more reliable. This is what you do:

  1. Bind a function to FWorldDelegates::OnWorldInitializedActors

    FWorldDelegates::OnWorldInitializedActors.AddRaw(this, &YourClass::OnWorldInitialized);

  2. In the function that is bound to OnWorldInitializedActors, bind a function to OnWorldBeginPlay that you want called when a map loads/when BeginPlay is done.

void YourClass::OnWorldInitialized(const UWorld::FActorsInitializedParams& Params)
{
	if (Params.World)
	{
		Params.World->OnWorldBeginPlay.AddRaw(this, &YourClass::FunctionToCall);
	}
}
1 Like