Editor crash when building Lightmass and World Partition Builder

Hello,

In our modifications to the Unreal Editor we kick of a custom build for indirect lighting which calls FEditorBuildUtils::EditorBuild and that works well. However, we noticed that a crash can occur if a build is running (our custom build or even just Lightmass) and another is launched such as Build World Partition Minimap (as well as HLOD and Spline builders). This is due to FEditorFileUtils::LoadMap being called after the World Partition builder completes, which results in an access violation. Of course as a user it is an odd action to perform in the first place, but it certainly seems like an unintended option that should be prevented.

Within FEditorFileUtils::LoadMap there is a call to GEditor->WarnIfLightingBuildIsCurrentlyRunning() which seems it would prevent the problem, but it happens after the builder completes and calls LoadMap from the World Partition builder.

We currently have a fix in place in WorldPartitionEditorModule.cpp:

`bool FWorldPartitionEditorModule::RunBuilder(const FRunBuilderParams& InParams)
{
// BEGIN OUR FIX
#if WITH_EDITOR
// Call WarnIfLightingBuildIsCurrentlyRunning as well so other builds can block the build as well.
if (GUnrealEd->WarnIfLightingBuildIsCurrentlyRunning())
{
return false;
}
#endif
// END OUR FIX
// Ideally this should be improved to automatically register all builders & present their options in a consistent way…

if (InParams.BuilderClass == UWorldPartitionHLODsBuilder::StaticClass())
{
return BuildHLODs(InParams);
}

if (InParams.BuilderClass == UWorldPartitionMiniMapBuilder::StaticClass())
{
return BuildMinimap(InParams);
}

if (InParams.BuilderClass == UWorldPartitionLandscapeSplineMeshesBuilder::StaticClass())
{
return BuildLandscapeSplineMeshes(InParams.World);
}

return Build(InParams);
}`This also results in the warning message pop-up that informs a build is currently in progress which is useful for the user.

I am raising this question mostly just to share what we found than being an actual question, but also is this fix appropriate or is there perhaps a better way to handle it?

Thank you for your time!

Steps to Reproduce
The issue can be reproduced in Vanilla UE5.5 with these steps:

  • File > New Level.. > Empty Open World
  • Add a new static mesh actor such as a cube
  • In World Settings uncheck Force No Precomputed Lighting
  • File > Save All and provide a level name
  • Build > Build Lighting Only
  • Before the lighting build completes, in the World Partition window choose Build > Build World Partition Minimap
  • Cancel the minimap build, or wait for it to complete
  • Wait for the lighting build to complete and click Apply Now

Hi Nathan,

I have put together a bug report for this, which can be tracked here if/when it’s approved for public visibility: Unreal Engine Issues and Bug Tracker (UE\-273273\). There is no ETA as priorities for bugs and features can shift at any time.

We don’t provide updates on UDN, but progress can be followed on that public issue tracker page.

In the interim, the fix you have in place should be sufficient in circumventing this bug.

Take care,

John