bOnlyCookProductionAssets
bOnlyCookProductionAssets
#Overview
name: bOnlyCookProductionAssets
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 bOnlyCookProductionAssets is to control whether development-only assets should be included in the cooking process for Unreal Engine projects. It is primarily used in the asset management system to determine which assets should be cooked for production builds.
This setting variable is mainly used by the Asset Manager subsystem in Unreal Engine. It is referenced in the UAssetManager and UAssetManagerSettings classes, which are part of the Engine module.
The value of this variable is set in the UAssetManagerSettings class, which is a UDeveloperSettings subclass. It can be configured through the project settings in the Unreal Editor.
bOnlyCookProductionAssets interacts with bTargetPlatformsAllowDevelopmentObjects, which can suppress the effect of bOnlyCookProductionAssets based on the target platforms being cooked.
Developers must be aware that when this variable is set to true, it will prevent assets marked as DevelopmentCook from being included in the final build. This can help reduce the size of production builds by excluding assets that are only needed during development.
Best practices when using this variable include:
- Set it to true for production builds to ensure only production-ready assets are included.
- Keep it false during development to allow access to development-only assets.
- Use it in conjunction with proper asset tagging and cook rules to effectively manage which assets are included in different build types.
- Be cautious when changing this setting, as it can significantly impact the content available in the final build.
- Regularly review and update asset cook rules to ensure they align with the intended use of this setting.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:52, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- 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/Runtime/Engine/Classes/Engine/AssetManager.h:823
Scope (from outer to inner):
file
class class UAssetManager : public UObject
Source code excerpt:
/** If true, DevelopmentCook assets will error when they are cooked */
UPROPERTY()
bool bOnlyCookProductionAssets;
/** Suppresses bOnlyCookProductionAssets based on the AllowsDevelopmentObjects() property of the TargetPlatforms being cooked. */
bool bTargetPlatformsAllowDevelopmentObjects;
bool bObjectReferenceListDirty = true;
/** >0 if we are currently in bulk scanning mode */
UPROPERTY()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/AssetManagerSettings.h:70
Scope (from outer to inner):
file
class class UAssetManagerSettings : public UDeveloperSettings
function UAssetManagerSettings
Source code excerpt:
public:
UAssetManagerSettings()
: bOnlyCookProductionAssets(false)
, bShouldGuessTypeAndNameInEditor(true)
, bShouldAcquireMissingChunksOnLoad(false)
, bShouldWarnAboutInvalidAssets(true)
{}
/** List of asset types to scan at startup */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/AssetManagerSettings.h:94
Scope (from outer to inner):
file
class class UAssetManagerSettings : public UDeveloperSettings
Source code excerpt:
/** If true, DevelopmentCook assets will error when they are cooked, you should enable this on production branches */
UPROPERTY(config, EditAnywhere, Category = "Asset Manager")
bool bOnlyCookProductionAssets;
/**
* If true, the asset manager will determine the type and name for Primary Assets that do not implement GetPrimaryAssetId, by calling DeterminePrimaryAssetIdForObject and using the ini settings.
* This works in both cooked and uncooked builds but is slower than directly implementing GetPrimaryAssetId on the native asset
*/
UPROPERTY(config, EditAnywhere, Category = "Asset Manager")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:420
Scope (from outer to inner):
file
function void UAssetManager::PostInitProperties
Source code excerpt:
// In editor builds guess the type/name if allowed
bShouldGuessTypeAndName = Settings.bShouldGuessTypeAndNameInEditor;
bOnlyCookProductionAssets = Settings.bOnlyCookProductionAssets;
// In editor builds, always allow asset registry searches for in-memory asset data, as that data can change when propagating AssetBundle tags post load.
bIncludeOnlyOnDiskAssets = false;
#else
// Never guess type in cooked builds
bShouldGuessTypeAndName = false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:4187
Scope (from outer to inner):
file
function void UAssetManager::ModifyCook
Source code excerpt:
GetPrimaryAssetTypeInfoList(TypeList);
bool bIncludeDevelopmentAssets = !bOnlyCookProductionAssets || bTargetPlatformsAllowDevelopmentObjects;
// Some primary assets exist in the transient package. No need to include them in the cook since they are transient.
FName TransientPackageName = GetTransientPackage()->GetFName();
// Uniquely append packages we need that are not already in PackagesToCook and PackagesToNeverCook
TSet<FName> PackagesToCookSet(PackagesToCook);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:4534
Scope (from outer to inner):
file
function bool UAssetManager::VerifyCanCookPackage
Source code excerpt:
}
else if ((CookRule == EPrimaryAssetCookRule::ProductionNeverCook || CookRule == EPrimaryAssetCookRule::DevelopmentAlwaysProductionNeverCook)
&& bOnlyCookProductionAssets && !bTargetPlatformsAllowDevelopmentObjects)
{
if (bLogError)
{
UE_LOG(LogAssetManager, Warning, TEXT("Package %s is set to ProductionNeverCook, and bOnlyCookProductionAssets is true, but something is trying to cook it! Instigators: %s"),
*PackageName.ToString(), *GetInstigatorChainString(CookInfo, PackageName));
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:4700
Scope (from outer to inner):
file
function void UAssetManager::ReinitializeFromConfig
Source code excerpt:
bShouldGuessTypeAndName = Settings.bShouldGuessTypeAndNameInEditor;
bShouldAcquireMissingChunksOnLoad = Settings.bShouldAcquireMissingChunksOnLoad;
bOnlyCookProductionAssets = Settings.bOnlyCookProductionAssets;
if (FCoreUObjectDelegates::GetPrimaryAssetIdForObject.IsBoundToObject(this))
{
FCoreUObjectDelegates::GetPrimaryAssetIdForObject.Unbind();
}
if (Settings.bShouldManagerDetermineTypeAndName)