How do you build lighting from the command line with streaming levels?

We are using streaming levels with the level compositor. I want to automate building lighting. I’ve been trying different variations of UE4Editor-Cmd.exe such as:

UE4Editor-Cmd.exe C:\Full\Path\To\Project.uproject -run=resavepackages -buildlighting -quality=high -FullLoadAndSave -AllowCommandletRendering -stdout -map=<see_below> -messaging

For the map, if I just specify the persistent level, then it only builds the lighting for the persistent level and does not built it for any of the streamed levels. If I pass in the all of the levels (using the level+level+level syntax), then it does build the lighting for all of the levels, but it seems to build each of the levels in isolation instead of loading them all and then building the lighting. Hence, the generated lighting is invalid since parts of the level that are affected by other levels do not get built (and indeed, when I load them in the editor, it says that lighting needs to be rebuilt.)

If I build from the editor by loading all of the levels and then use the “Build Lighting” menu option, it builds the light maps correctly.

Is there some additional command line arguments that I need to specify to build the lighting correctly?

It should build the lighting for the stream levels that are visible in the viewport.

So you would need to turn the stream level visibility to ON in each persistant level and save them (in the editor), then execute the command line. If you have multiple options possible, I guess you would need to make a new build for each one.

Maybe you could use editor scripting to automate the visibility toggle of the stream levels ? There is a “Set level visibility” node in blueprints