Unreal Engine stores content assets in particular formats which it uses internally, such as PNG for texture data or WAV for audio. However, this content needs to be converted to different formats for the various platforms, either because the platform uses a proprietary format, does not support the format Unreal uses to store the asset, or a more memory- or performance-effective format exists. The process of converting content from the internal format to the platform-specific format is referred to as cooking.
Cooking Content from the Command Line
To cook data for your game, you need to use the Cook commandlet.
The basic cook is performed via the following:
UE4Editor.exe <GameName or uproject> -run=cook -targetplatform=<Plat1>+<Plat2> [-cookonthefly] [-iterate] [-map=<Map1>+<Map2>]
Or
UE4Editor-Cmd.exe <GameName> -run=cook -targetplatform=<Plat1>+<Plat2> [-cookonthefly] [-iterate] [-map=<Map1>+<Map2>]
The commandlet must be specified via -run=cook
and a platform to cook must also be specified. This will generate
cooked data for the platform specified and saved it to the location below:
<Game>/Saved/Sandboxes/Cooked-<Platform>
Options
Option | Description |
---|---|
-targetplatform=<Plat1>+<Plat2> |
Specifies the platform(s) to be cooked. The list of available platforms are WindowsNoEditor, WindowsServer, LinuxServer, PS4, XboxOne, IOS, and Android. |
-iterate |
Specifies the cooker only cook items that are out of date. Without this option, the sandbox directory is deleted and everything is recooked. |
-Map=<Map1>+<Map2>+... |
Specifies the map(s) to build. |
-cookonthefly |
Specifies that the cooker be started in server mode. This will launch a server which waits for a game to connect and then serves the cooked data as needed. When this option is used, the game requires -filehostip=<Server IP> specified on its command line so it can connect with the server. |
-MapIniSection=<ini file section> |
Specifies a section from the ini files which contains map names. The cooker will cook all maps specified in the section specified. |
-UnVersioned |
Saves all of the cooked packages without versions. These are then assumed to be the current version on load. |
-CookAll |
Cooks everything. |
-Compressed |
Tells the cooker to compress the cooked packages. |