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!