Automating Lightmapping in Unreal Engine 4.18
If you want to know how to build lightmaps for all maps in an Unreal Engine 4.18, and you want to do it from the command line (for example, on your build server), this article documents how to do it.
There seems to be no documentation on how to do this properly on the Internet. Or when there is, it’s for 3 versions ago and is no longer relevant. So after spending a day trying to get this working, I figured I’d document the proper way of automating lightmapping in Unreal Engine 4.18.
A quick guide on the PowerShell script outlined below:
- It should be in the root of your Unreal Engine project folder, next to your .uproject file.
- Update the first argument so that the .uproject filename matches (in the example it’s MinuteOfMayhem.uproject and you just need to change it).
- This assumes all your levels are underneath “Content/Levels”. If you have your levels under a different folder, change the first line to match what that folder is. You can also set it to just “Content”, but this will rebuild all of the content in your project, not just maps.
With this PowerShell script created in your project directory, you should now be able to run the following from any PowerShell prompt (just navigate to the directory of your project first):
Hopefully this helps someone else who, like us, is trying to automate lightmapping on their build server!