Unreal Cloud Docs
Guides

Package an Unreal Engine project from the command line

The BuildCookRun command for Windows, Linux and Android, what each flag does, and what to check when it fails.

Clicking Package Project in the editor is fine until you want builds to happen without you: on a build machine, from a script, or after every commit. Behind that button, the editor runs a tool called the Unreal Automation Tool, or UAT. You can run it yourself.

The command

Here's a full build with a launcher-installed engine. Swap in your own engine version and paths:

"C:\Program Files\Epic Games\UE_5.4\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun ^
  -project="C:\Projects\MyGame\MyGame.uproject" ^
  -platform=Win64 ^
  -clientconfig=Development ^
  -build -cook -stage -pak -archive ^
  -archivedirectory="C:\Builds\MyGame" ^
  -noP4 -unattended -utf8output
./Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \
  -project="$HOME/Projects/MyGame/MyGame.uproject" \
  -platform=Linux \
  -clientconfig=Development \
  -build -cook -stage -pak -archive \
  -archivedirectory="$HOME/Builds/MyGame" \
  -noP4 -unattended -utf8output

When it's done, your game is in the archive folder, inside a subfolder named after the platform, like Windows or Linux.

What the flags mean

It looks like a lot, but most of the flags just switch on the steps you want, in this order:

-build
Compiles your C++ code
-cook
Converts assets for the platform. Usually the slow part
-stage
Puts everything the game needs into one folder
-pak
Packs content into a few large files
-archive
Copies the build to -archivedirectory

The rest:

  • -platform is what you're building for: Win64, Linux, Android and so on.
  • -clientconfig is the build configuration. Use Development while testing and Shipping for release.
  • -noP4 stops UAT from looking for Perforce. Keep it unless you want Perforce info baked into the build.
  • -unattended makes sure nothing waits for someone to click a button. You need it on a build machine.
  • -utf8output keeps the log readable when another program captures it.

A few more you might want:

  • -prereqs adds Unreal's prerequisites installer to Windows builds, which helps players who don't have the right runtimes.
  • -nodebuginfo leaves out debug symbols for a smaller build.
  • -clean throws away previous results and rebuilds everything. It's slow, so use it when something seems stale, not every time.

Android

Android needs one extra flag, -cookflavor, which picks the texture format. ASTC works on most modern phones:

RunUAT.bat BuildCookRun -project="C:\Projects\MyGame\MyGame.uproject" ^
  -platform=Android -cookflavor=ASTC ^
  -clientconfig=Development ^
  -build -cook -stage -pak -archive -archivedirectory="C:\Builds\MyGame" ^
  -noP4 -unattended -utf8output

The machine also needs the Android SDK, NDK and JDK versions your engine expects. If you can already package for Android from the editor on that machine, you're set. If not, see Android setup.

Dedicated servers

For a server build, swap the client flags for server ones:

RunUAT.bat BuildCookRun -project="C:\Projects\MyGame\MyGame.uproject" ^
  -server -noclient -serverplatform=Linux -serverconfig=Development ^
  -build -cook -stage -pak -archive -archivedirectory="C:\Builds\MyGameServer" ^
  -noP4 -unattended -utf8output

This only works with an engine built from source, and your project needs a MyGameServer.Target.cs file in its Source folder. With the launcher version of the engine you'll get "Couldn't find target rules file", and no flag will fix that.

When it fails

The last line of the log is usually just a summary. Scroll up, or search for the first Error:. That's almost always the real problem.

On Windows with a launcher engine, the full logs are in %AppData%\Unreal Engine\AutomationTool\Logs.

Some common ones:

  • A cook error naming an asset. The asset is usually broken or references something that was deleted. Open it in the editor, fix any warnings, and save it again.
  • Compile errors you don't get in the editor. Often code that only runs in Shipping, or a missing #include that the editor's build happened to cover for.

For more, see Packaging errors, explained.

Running it on every commit

Once the command works on your machine, the obvious next step is running it automatically, so every push gives your team a fresh build to test.

On this page