Download

Headless unit tests crashes when creating Blueprint

I’m co-developing a plugin to Unreal Engine and we have some unit tests in our project.
The unit-tests are running the Editor without a GUI from command line. This is achieved by passing the -NullRHI command line argument to the Editor executable.

This generally works great, but we have a situation that causes a hard crash:
In one of our unit tests, we create a Blueprint by calling FKismetEditorUtilities::CreateBlueprintFromActor. This function will end up calling GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(NewBlueprint); i.e. launcing the asset editor for the new Blueprint. Calling the above function while running with -NullRHI seems to always result in a hard crash with a callstack printed out in the logs.

There is no way to stop the FKismetEditorUtilities::CreateBlueprintFromActor function to call GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(NewBlueprint); in UE 4.25.

So my question is; does anyone know how this can be worked around somehow? I’ve tried with the -server argument but that’s not what we want.
Is using -NullRHI even the correct way of running headless, or is there a better way?

Thanks!