Why does SwarmAgent.exe revert to its default settings when during a lighting build?


The swarmagent.exe that is launched during a lighting build via the resavepackages commandlet fails to read our
SwarmAgent.options.xml file.

Currently, I run the following command line to bake the lights:
UE4Editor-Cmd.exe c:\ourPath\Game.uproject -Run=resavepackages -buildlighting -quality=Production -allowcommandletrendering -allmaps

However, the swarm agent that is launched uses the default RENDER-01 name in the CoordinatorRemotingHost field. We have a SwarmAgent.Options.xml file that contains our DNS name and If I launch the swarm agent manually, it contains the correct CoordinatorRemotingHost name.

How do I get our SwarmAgent.Options.xml file to be read when we are baking the lights?
Thank You.


I’ve been setting up a swarm and this is what I gathered.

If you start a SwarmAgent.exe from any location manually then when the editor (UE4Editor.exe or UE4editor-Cmd.exe) is about to start SwarmAgent.exe it will not start a new instance, it will use the one already running. SwarmAgent.exe will in this case use the SwarmAgent.Options.xml from the path it started in.

If you let the editor start SwarmAgent.exe it will use the option -OptionsFolder=“C:/Users/[user name]/AppData/Local/UnrealEngine/4.22/Saved/Swarm”. I’m guessing it’s using the LOCALAPPDATA environment variable in Windows (%LOCALAPPDATA%\UnrealEngine\[UEversion]\Saved\Swarm).

The default SwarmCache folder will be created where the options file is going to be placed if there is none at start. So %LOCALAPPDATA%\UnrealEngine\[UEversion]\Saved\Swarm\SwarmCache for the one started by the editor. If the defined SwarmCache folder is not present it will be created automatically.

So as I see it you have two good options:

  1. Start SwarmAgent.exe manually from a location of your choosing before you start your bake.
  2. Configure the one started by the editor. Either place your config file where it expect it to be or simply configure the one started by the editor after it started, it will then save your settings to be reused whenever it’s started.

My preferred option is 1 because it gives me more control over the agent process.

Hope that clears it up for you.

Note that I’m using 4.22.3 and not 4.20 but I’m guessing/hoping all of the above applies.

I used Process Explorer to find what arguments was used to start SwarmAgent.exe with. (Process Explorer - Windows Sysinternals | Microsoft Docs). Handle (Handle - Windows Sysinternals | Microsoft Docs) and Process Monitor (Process Monitor - Windows Sysinternals | Microsoft Docs) can be usefull when trying to figure out what is going on aswell.