CanSkipEditorReferencedPackagesWhenCooking

CanSkipEditorReferencedPackagesWhenCooking

#Overview

name: CanSkipEditorReferencedPackagesWhenCooking

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 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of CanSkipEditorReferencedPackagesWhenCooking is to determine whether packages that are only referenced by editor-specific properties can be skipped during the cooking process. This setting is primarily used in the package saving and cooking systems of Unreal Engine.

This setting variable is relied upon by the CoreUObject module, specifically in the package saving and cooking subsystems. It’s used in the SavePackage functionality, which is a critical part of Unreal Engine’s content pipeline.

The value of this variable is set in the engine configuration file (GEngineIni). It’s read from the “Core.System” section with the key “CanSkipEditorReferencedPackagesWhenCooking”.

This variable interacts with the package flags, particularly PKG_EditorOnly, and the IsLoadedByEditorPropertiesOnly() function of UPackage.

Developers must be aware that this setting can significantly impact the cooking process. When set to true, it can reduce the size of cooked content by excluding editor-only packages, but it may also lead to missing content if not used carefully.

Best practices when using this variable include:

  1. Ensure that all necessary content for the game is not marked as editor-only if this setting is enabled.
  2. Thoroughly test the cooked content when changing this setting to ensure no critical assets are missing.
  3. Use this in conjunction with proper asset management and tagging to effectively separate editor-only content from runtime content.
  4. Consider the implications on different build configurations (Development, Shipping, etc.) when modifying this setting.
  5. Document any changes to this setting in the project, as it can have significant effects on the final packaged game.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:1438, section: [Core.System]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage/SaveContext.h:679

Scope (from outer to inner):

file
class        class FSaveContext
function     bool CanSkipEditorReferencedPackagesWhenCooking

Source code excerpt:

	}

	bool CanSkipEditorReferencedPackagesWhenCooking() const
	{
		return SkipEditorRefCookingSetting;
	}

	bool IsIgnoringHeaderDiff() const
	{

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage/SavePackageUtilities.cpp:1848

Scope (from outer to inner):

file
function     FCanSkipEditorReferencedPackagesWhenCooking::FCanSkipEditorReferencedPackagesWhenCooking

Source code excerpt:


FCanSkipEditorReferencedPackagesWhenCooking::FCanSkipEditorReferencedPackagesWhenCooking()
	: bCanSkipEditorReferencedPackagesWhenCooking(UE::SavePackageUtilities::CanSkipEditorReferencedPackagesWhenCooking())
{
}

namespace UE::SavePackageUtilities
{

bool CanSkipEditorReferencedPackagesWhenCooking()
{
	bool bResult = true;
	GConfig->GetBool(TEXT("Core.System"), TEXT("CanSkipEditorReferencedPackagesWhenCooking"), bResult, GEngineIni);
	return bResult;
}

/**
 * Static: Saves thumbnail data for the specified package outer and linker
 *

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage2.cpp:101

Scope (from outer to inner):

file
namespace    anonymous
function     ESavePackageResult ValidatePackage

Source code excerpt:

		{
			// Don't save packages marked as editor-only.
			if (SaveContext.CanSkipEditorReferencedPackagesWhenCooking() && SaveContext.GetPackage()->IsLoadedByEditorPropertiesOnly())
			{
				UE_CLOG(SaveContext.IsGenerateSaveError(), LogSavePackage, Verbose, TEXT("Package loaded by editor-only properties: %s. Package will not be saved."), *SaveContext.GetPackage()->GetName());
				return ESavePackageResult::ReferencedOnlyByEditorOnlyData;
			}
			else if (SaveContext.GetPackage()->HasAnyPackageFlags(PKG_EditorOnly))
			{

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Public/UObject/SavePackage.h:317

Scope (from outer to inner):

file
namespace    UE::SavePackageUtilities

Source code excerpt:

	COREUOBJECT_API void EDLCookInfoMoveToCompactBinaryAndClear(FCbWriter& Writer, bool& bOutHasData, FName PackageName);
	COREUOBJECT_API bool EDLCookInfoAppendFromCompactBinary(FCbFieldView Field);
	COREUOBJECT_API bool CanSkipEditorReferencedPackagesWhenCooking();


#if WITH_EDITOR
	/** void FAddResaveOnDemandPackage(FName SystemName, FName PackageName); */
	DECLARE_DELEGATE_TwoParams(FAddResaveOnDemandPackage, FName, FName);
	/**