0 3分钟 2 月

Understanding the UE4 Cook Process

When working with Unreal Engine 4 (UE4), the cook process is a critical step in preparing your game for deployment. It involves compiling and optimizing your game’s assets, ensuring they are ready for the target platform. In this article, we’ll delve into the details of the UE4 cook process, specifically focusing on cooking Unreal Script Text (USDT) files.

What is Cooking in UE4?

Cooking in UE4 is the process of converting your project’s assets into a format that can be used by the engine. This includes compiling C++ code, converting materials, and optimizing textures. One of the key components of the cooking process is the handling of Unreal Script Text (USDT) files.

USDT Files: The Heart of Cooking

USDT files are text files that contain the metadata for your game’s assets. They include information such as the asset’s name, type, and properties. During the cooking process, these files are used to ensure that all assets are correctly compiled and optimized for the target platform.

Adding the -DisableCookAssert Switch

One of the switches you might want to add to your cook command is -DisableCookAssert. This switch tells the engine to disable assertion checks during the cooking process. Assertions are used to detect errors in the code, but they can also slow down the cooking process. Here’s how you can add it to your command:

EnginePath/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -projectClientPath/ProjectName.uproject -noP4 -platformIOS -cooksinglepackage -client -clientconfigCookConfig -iterate -skipbuild -nocompile -NoMutex -cook -DisableUnsolicitedPackages -DisableCrashPackageReport -FastCook -SkipCookingEditorContent -skippak -skipstage -skipdeploy -ignorejunk -buildmachine -manifests -prereqs PARAMIGNORECOOKERRORS SHADERCOMPRESS -AdditionalCookerOptions"-IgnoreIniSettingsOutOfDate -DisableUnsolicitedPackages" -logClientPath/Saved/CookLog.log -DisableCookAssert

Passing Parameters to UE4Editor

Once you’ve added the -DisableCookAssert switch to your cook command, you’ll want to pass this parameter to UE4Editor. Here’s how you can do it:

EnginePath/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -projectClientPath/ProjectName.uproject -noP4 -platformIOS -cooksinglepackage -client -clientconfigCookConfig -iterate -skipbuild -nocompile -NoMutex -cook -DisableUnsolicitedPackages -DisableCrashPackageReport -FastCook -SkipCookingEditorContent -skippak -skipstage -skipdeploy -ignorejunk -buildmachine -manifests -prereqs PARAMIGNORECOOKERRORS SHADERCOMPRESS -AdditionalCookerOptions"-IgnoreIniSettingsOutOfDate -DisableUnsolicitedPackages" -logClientPath/Saved/CookLog.log -DisableCookAssert -runeditor

Understanding the Command

Let’s break down the command to understand each part:

Command Description
EnginePath/Engine/Build/BatchFiles/RunUAT.sh The script that runs the Unreal Engine 4 command line tools.
BuildCookRun The command to build, cook, and run your game.
-projectClientPath/ProjectName.uproject The path to your project’s .uproject file.
-noP4 Disables Perforce version control.
-platformIOS Indicates that the build is for the iOS platform.
-cooksinglepackage Cooks a single package.
-client Indicates that the build is for the client.
-clientconfigCookConfig Uses the client configuration