bSerializePackageData

bSerializePackageData

#Overview

name: bSerializePackageData

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

#Summary

#Usage in the C++ source code

The purpose of bSerializePackageData is to control the serialization of FAssetPackageData in the Unreal Engine 5 Asset Registry system. This setting variable is primarily used for managing the serialization and deserialization of package data within the asset registry.

This setting variable is primarily relied upon by the Asset Registry subsystem, which is part of the core engine modules. It is used in the AssetRegistry and AssetRegistryState components.

The value of this variable is typically set through the engine configuration files (INI files). It can be read from the “AssetRegistry” section of the engine INI file using the key “bSerializePackageData”.

bSerializePackageData interacts with other serialization-related variables in the FAssetRegistrySerializationOptions struct, such as bSerializeDependencies, bSerializeSearchableNameDependencies, and bSerializeManageDependencies. These variables collectively control what data is serialized in the asset registry.

Developers must be aware that setting this variable to true will increase the size of the serialized asset registry data, as it includes the package data. This can impact loading times and memory usage, especially for large projects with many assets.

Best practices when using this variable include:

  1. Only enable it when package data is necessary for your project’s functionality.
  2. Consider the performance implications, especially for runtime scenarios or when working with large asset sets.
  3. Use it in conjunction with other serialization options to fine-tune the asset registry’s behavior for your specific needs.
  4. Be consistent in its usage across development and runtime environments to ensure proper functionality.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2739, section: [AssetRegistry]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AssetRegistry/Private/AssetRegistry.cpp:1312

Scope (from outer to inner):

file
namespace    UE::AssetRegistry
namespace    Utils
function     void InitializeSerializationOptionsFromIni

Source code excerpt:

		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bSerializeNameDependencies"), Options.bSerializeSearchableNameDependencies);
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bSerializeManageDependencies"), Options.bSerializeManageDependencies);
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bSerializePackageData"), Options.bSerializePackageData);
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bFilterAssetDataWithNoTags"), Options.bFilterAssetDataWithNoTags);
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bFilterDependenciesWithNoTags"), Options.bFilterDependenciesWithNoTags);
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bFilterSearchableNames"), Options.bFilterSearchableNames);
	}

	EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bUseAssetRegistryTagsWhitelistInsteadOfBlacklist"), Options.bUseAssetRegistryTagsAllowListInsteadOfDenyList);

#Loc: <Workspace>/Engine/Source/Runtime/AssetRegistry/Private/AssetRegistryState.cpp:1458

Scope (from outer to inner):

file
function     bool FAssetRegistryState::Save

Source code excerpt:

	// Serialize the PackageData
	int32 PackageDataCount = 0;
	if (Options.bSerializePackageData)
	{
		PackageDataCount = CachedPackageData.Num();
		Ar << PackageDataCount;

		TArray<TPair<FName, FAssetPackageData*>> SortedPackageData = CachedPackageData.Array();
		Algo::Sort(SortedPackageData, [](TPair<FName, FAssetPackageData*>& A, TPair<FName, FAssetPackageData*>& B) { return A.Key.LexicalLess(B.Key); });

#Loc: <Workspace>/Engine/Source/Runtime/AssetRegistry/Public/AssetRegistry/AssetRegistryState.h:62

Scope: file

Source code excerpt:


	/** If true will read/write FAssetPackageData */
	bool bSerializePackageData = false;

	/** True if CookFilterlistTagsByClass is an allow list. False if it is a deny list. */
	bool bUseAssetRegistryTagsAllowListInsteadOfDenyList = false;

	/** True if we want to only write out asset data if it has valid tags. This saves memory by not saving data for things like textures */
	bool bFilterAssetDataWithNoTags = false;

#Loc: <Workspace>/Engine/Source/Runtime/AssetRegistry/Public/AssetRegistry/AssetRegistryState.h:102

Scope (from outer to inner):

file
function     void InitForDevelopment

Source code excerpt:

	void InitForDevelopment()
	{
		bSerializeAssetRegistry = bSerializeDependencies = bSerializeSearchableNameDependencies = bSerializeManageDependencies = bSerializePackageData = true;
		DisableFilters();
	}
};

struct FAssetRegistryLoadOptions
{

#Loc: <Workspace>/Engine/Source/Runtime/AssetRegistry/Public/AssetRegistry/AssetRegistryState.h:112

Scope (from outer to inner):

file
function     explicit FAssetRegistryLoadOptions

Source code excerpt:

	explicit FAssetRegistryLoadOptions(const FAssetRegistrySerializationOptions& Options)
		: bLoadDependencies(Options.bSerializeDependencies)
		, bLoadPackageData(Options.bSerializePackageData)
	{}

	bool bLoadDependencies = true;
	bool bLoadPackageData = true;
	int32 ParallelWorkers = 0;
};