bCookAll
bCookAll
#Overview
name: bCookAll
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bCookAll is to control whether all content in the project should be cooked during the packaging process. This setting is primarily used in the cooking and packaging system of Unreal Engine.
The Unreal Engine subsystems that rely on this setting variable are primarily the packaging system and the cook-on-the-fly server. It’s used in the ProjectPackagingSettings class and the CookCommandlet.
The value of this variable is set in multiple places:
- In the ProjectPackagingSettings, where it can be configured by users in the project settings.
- As a command-line switch in the CookCommandlet.
- It can also be influenced by the ECookByTheBookOptions flag in the CookByTheBook function.
This variable interacts with other variables such as bCookMapsOnly and ECookByTheBookOptions flags. It also affects the behavior of content collection for cooking in the CollectFilesToCook function.
Developers must be aware that setting this to true will cook all content in the project, which can significantly increase build times and output size. It’s particularly important to consider this when working on large projects or when trying to optimize build processes.
Best practices when using this variable include:
- Use it judiciously, as cooking all content can be time-consuming and may not always be necessary.
- Consider using it in conjunction with bCookMapsOnly to cook all maps but not other content.
- Be aware of its interaction with command-line switches and other cooking options to ensure the desired behavior.
- Use it for final builds or when you need to ensure all content is included, but consider more selective cooking options during development to save time.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:141, section: [/Script/UnrealEd.ProjectPackagingSettings]
- INI Section:
/Script/UnrealEd.ProjectPackagingSettings
- Raw value:
False
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Classes/Settings/ProjectPackagingSettings.h:478
Scope (from outer to inner):
file
class class UProjectPackagingSettings : public UObject
Source code excerpt:
*/
UPROPERTY(config, EditAnywhere, Category=Packaging, AdvancedDisplay, meta=(DisplayName="Cook everything in the project content directory (ignore list of maps below)"))
bool bCookAll;
/**
* Cook only maps (this only affects the cookall flag)
*/
UPROPERTY(config, EditAnywhere, Category=Packaging, AdvancedDisplay, meta=(DisplayName="Cook only maps (this only affects cookall)"))
bool bCookMapsOnly;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Commandlets/CookCommandlet.h:39
Scope (from outer to inner):
file
class class UCookCommandlet : public UCommandlet
Source code excerpt:
bool bFastCook;
/** Cook everything */
bool bCookAll;
/** Skip saving any packages in Engine/Content/Editor* UNLESS TARGET HAS EDITORONLY DATA (in which case it will save those anyway) */
bool bSkipEditorContent;
/** Save all cooked packages without versions. These are then assumed to be current version on load. This is dangerous but results in smaller patch sizes. */
bool bUnversioned;
/** Produce editor optional package output when cooking. */
bool bCookEditorOptional;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/CookCommandlet.cpp:175
Scope (from outer to inner):
file
function int32 UCookCommandlet::Main
Source code excerpt:
bCookOnTheFly = Switches.Contains(TEXT("COOKONTHEFLY")); // Prototype cook-on-the-fly server
bCookAll = Switches.Contains(TEXT("COOKALL")); // Cook everything
bUnversioned = Switches.Contains(TEXT("UNVERSIONED")); // Save all cooked packages without versions. These are then assumed to be current version on load. This is dangerous but results in smaller patch sizes.
bCookEditorOptional = Switches.Contains(TEXT("EDITOROPTIONAL")); // Produce the optional editor package data alongside the cooked data.
bGenerateStreamingInstallManifests = Switches.Contains(TEXT("MANIFESTS")); // Generate manifests for building streaming install packages
bIterativeCooking = Switches.Contains(TEXT("ITERATE")) || Switches.Contains(TEXT("ITERATIVE"));
bSkipEditorContent = Switches.Contains(TEXT("SKIPEDITORCONTENT")); // This won't save out any packages in Engine/Content/Editor*
bErrorOnEngineContentUse = Switches.Contains(TEXT("ERRORONENGINECONTENTUSE"));
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/CookCommandlet.cpp:192
Scope (from outer to inner):
file
function int32 UCookCommandlet::Main
Source code excerpt:
bFastCook = Switches.Contains(TEXT("FastCook"));
COOK_STAT(DetailedCookStats::IsCookAll = bCookAll);
COOK_STAT(DetailedCookStats::IsCookOnTheFly = bCookOnTheFly);
COOK_STAT(DetailedCookStats::IsIterativeCook = bIterativeCooking);
COOK_STAT(DetailedCookStats::IsFastCook = bFastCook);
COOK_STAT(DetailedCookStats::IsUnversioned = bUnversioned);
COOK_STAT(DetailedCookStats::CookProject = FApp::GetProjectName());
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/CookCommandlet.cpp:393
Scope (from outer to inner):
file
function bool UCookCommandlet::CookByTheBook
Source code excerpt:
ECookByTheBookOptions CookOptions = ECookByTheBookOptions::None;
CookOptions |= bCookAll ? ECookByTheBookOptions::CookAll : ECookByTheBookOptions::None;
CookOptions |= Switches.Contains(TEXT("MAPSONLY")) ? ECookByTheBookOptions::MapsOnly : ECookByTheBookOptions::None;
CookOptions |= Switches.Contains(TEXT("NODEV")) ? ECookByTheBookOptions::NoDevContent : ECookByTheBookOptions::None;
if (Switches.Contains(TEXT("FullLoadAndSave"))) // Deprecated in UE 5.3
{
UE_LOG(LogCook, Warning, TEXT("-FullLoadAndSave has been deprecated; remove the argument to remove this warning.\n")
TEXT("For cook optimizations, try using multiprocess cook (-cookprocesscount=<N>, N>1).\n")
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/CookOnTheFlyServer.cpp:8949
Scope (from outer to inner):
file
function void UCookOnTheFlyServer::CollectFilesToCook
Source code excerpt:
UProjectPackagingSettings* PackagingSettings = Cast<UProjectPackagingSettings>(UProjectPackagingSettings::StaticClass()->GetDefaultObject());
bool bCookAll = (!!(FilesToCookFlags & ECookByTheBookOptions::CookAll)) || PackagingSettings->bCookAll;
bool bMapsOnly = (!!(FilesToCookFlags & ECookByTheBookOptions::MapsOnly)) || PackagingSettings->bCookMapsOnly;
bool bNoDev = !!(FilesToCookFlags & ECookByTheBookOptions::NoDevContent);
int32 InitialNum = FilesInPath.Num();
struct FNameWithInstigator
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/CookOnTheFlyServer.cpp:9202
Scope (from outer to inner):
file
function void UCookOnTheFlyServer::CollectFilesToCook
Source code excerpt:
// If no packages were explicitly added by command line or game callback, add all maps
if (bCookAll || (UE::Cook::bCookAllByDefault && FilesInPath.Num() == InitialNum))
{
TArray<FString> Tokens;
Tokens.Empty(2);
Tokens.Add(FString("*") + FPackageName::GetAssetPackageExtension());
Tokens.Add(FString("*") + FPackageName::GetMapPackageExtension());