This level A should be included as level instance into another level B
delete an actor
if the A level opened in p.1 has other maps (e.g. B) referencing it, those are loaded to validate/update references
ULevel::OnLevelLoaded() in Level.cpp, performs a series of checks, and when finding out that the loaded level has world partition subsystem, Initializes it for level B as well
Start PIE
We observe that now all levels(e.g. B) are pulled in when validating the delete are going through actor desc validation which costs CPU and log spam (we had some errors / warnings at the time)
These errors are misleading as they have nothing to do with level being tested
Eventually, none of these levels actually contribute to PIE world so it feels like the work done on PIE is unnecessary as it slows down PIE times and over time could slow down the editor by putting memory pressure on the log pane (due to log spam).
[Attachment Removed]
Thanks for the clarification. After discussion with the team, we think there might be unforeseen side effects to skip the initialization. We are currently evaluating another avenue to reduce the unrequired work. In UWorldPartition::RegisterDelegates(), only register the first 4 delegates for EWorldType::Editor. This prevent the validation code to run on the extra levels.
void UWorldPartition::RegisterDelegates()
{
check(World);
#if WITH_EDITOR
if (GEditor && !IsTemplate() && !World->IsGameWorld() && !IsRunningCookCommandlet())
{
if (IsMainWorldPartition())
{
// PIE lifecycle delegates are only relevant for the world PIE will duplicate from, i.e. the editor world.
// Worlds that are incidentally loaded and initialized as Inactive (see UEditorEngine::InitializeNewlyCreatedInactiveWorld)
// are never a PIE duplication source, so PrepareEditorGameWorld would run a full GenerateStreaming on every PIE
// start and discard the result, while polluting the map check dialog with errors unrelated to the played level.
if (World->WorldType == EWorldType::Editor)
{
FEditorDelegates::PreBeginPIE.AddUObject(this, &UWorldPartition::OnPreBeginPIE);
FEditorDelegates::PrePIEEnded.AddUObject(this, &UWorldPartition::OnPrePIEEnded);
FEditorDelegates::CancelPIE.AddUObject(this, &UWorldPartition::OnCancelPIE);
FGameDelegates::Get().GetEndPlayMapDelegate().AddUObject(this, &UWorldPartition::ShutdownEditorGameWorld);
}
// Those are needed by any initialized world partition, whatever the world type, to keep the actor desc container consistent.
GEditor->OnLevelActorDeleted().AddUObject(this, &UWorldPartition::OnLevelActorDeleted);
GEditor->OnPostBugItGoCalled().AddUObject(this, &UWorldPartition::OnPostBugItGoCalled);
GEditor->OnEditorClose().AddUObject(this, &UWorldPartition::SavePerUserSettings);
FWorldDelegates::OnPostWorldRename.AddUObject(this, &UWorldPartition::OnWorldRenamed);
}
...