PostRegisterAllComponents

Hey there,

I have to run some c++ code(altering some physics bodies) that is supposed to be executed after a map is completely loaded in the Editor(not PIE) and before navigation is automatically being rebuilt.

What I need is the equivalent to BeginPlay(), I tried PostLoad() but not all data(and all components) are available at that point. PostRegisterAllComponents() which is called after that is a bit better, but for some reason Actor-Transform data is not yet available there( I get Zero for the actor position).

When I run the code during the first Tick() in Editor(I am using ShouldTickIfViewportsOnly to do that) everything is working, but this is too late as the navmesh has already been built and the changes I made to the physics bodies are not being taken into account.

Are there any useful methods/callbacks between Actor->PostRegisterAllComponents() and Actor->Tick() I could use?

Thank you!

I solved the issue by subscribing to the event GEngine->OnWorldAdded().AddUObject(). This is executed after the map is loaded in the Editor and all the actors are set up. I also tried FEditorDelegates::MapChange which is executed before that, but that didn’t work as navigation wasn’t ready there yet.

So if you’re having a similar issue go with “OnWorldAdded”, also you need to make sure when subscribing and unsubscribing to this event that your actor has a valid actor->GetWorld(). Therefore dont’ subscribe to that event in your Actor’s constructor as this will result in a crash(use PostLoad instead).