bSerializeAssetRegistry

bSerializeAssetRegistry

#Overview

name: bSerializeAssetRegistry

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

#Summary

#Usage in the C++ source code

The purpose of bSerializeAssetRegistry is to control whether the Asset Registry should be serialized (saved or loaded) in Unreal Engine 5. This variable is primarily used in the Asset Registry system, which is responsible for tracking and managing information about assets in the engine.

The Asset Registry subsystem and the UnrealEd module rely on this setting variable. It is used in both the editor (for generating asset registries) and the runtime (for loading premade asset registries).

The value of this variable is typically set in the engine configuration file (Engine.ini) under the [AssetRegistry] section. It can also be set programmatically, as seen in the InitForDevelopment() function.

This variable interacts with other serialization-related variables such as bSerializeDependencies, bSerializeSearchableNameDependencies, bSerializeManageDependencies, and bSerializePackageData. These variables control different aspects of what gets serialized in the Asset Registry.

Developers must be aware that this variable significantly impacts the Asset Registry’s functionality. When set to true, it enables the serialization of the Asset Registry, which is crucial for features like cooking content for different platforms and loading optimized asset data at runtime.

Best practices when using this variable include:

  1. Ensure it’s set to true for production builds to take advantage of optimized asset loading.
  2. Consider setting it to false during development if you need to frequently rebuild the Asset Registry for testing purposes.
  3. Be consistent with its usage across different build configurations to avoid unexpected behavior.
  4. When modifying this variable, also review the related serialization options to ensure they align with your project’s needs.
  5. Remember that changing this variable may require rebuilding the Asset Registry, which can be a time-consuming process for large projects.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/AssetRegistryGenerator.cpp:1687

Scope (from outer to inner):

file
function     bool FAssetRegistryGenerator::SaveAssetRegistry

Source code excerpt:

	UpdateCollectionAssetData();

	if (DevelopmentSaveOptions.bSerializeAssetRegistry)
	{
		FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *TargetPlatform->PlatformName());
		const TCHAR* DevelopmentAssetRegistryFilename = GetDevelopmentAssetRegistryFilename();
		PlatformSandboxPath.ReplaceInline(TEXT("AssetRegistry.bin"), *FString::Printf(TEXT("Metadata/%s"), DevelopmentAssetRegistryFilename));

		if (bSerializeDevelopmentAssetRegistry)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/AssetRegistryGenerator.cpp:1738

Scope (from outer to inner):

file
function     bool FAssetRegistryGenerator::SaveAssetRegistry

Source code excerpt:

	}

	if (SaveOptions.bSerializeAssetRegistry)
	{
		TMap<int32, FString> ChunkBucketNames;
		TMap<int32, TSet<int32>> ChunkBuckets;
		const int32 GenericChunkBucket = -1;
		ChunkBucketNames.Add(GenericChunkBucket, FString());

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

Scope (from outer to inner):

file
namespace    UE::AssetRegistry
function     void FAssetRegistryImpl::LoadPremadeAssetRegistry

Source code excerpt:

	UE_SCOPED_ENGINE_ACTIVITY("Loading premade asset registry");

	if (SerializationOptions.bSerializeAssetRegistry)
	{
		SCOPED_BOOT_TIMING("LoadPremadeAssetRegistry_Main");
		if (LoadResult == Premade::ELoadResult::Succeeded)
		{
			if (State.GetNumAssets() == 0)
			{

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

Scope (from outer to inner):

file
namespace    UE::AssetRegistry
namespace    Utils
function     void InitializeSerializationOptionsFromIni

Source code excerpt:

	if (!bForDevelopment)
	{
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bSerializeAssetRegistry"), Options.bSerializeAssetRegistry);
		EngineIni->GetBool(TEXT("AssetRegistry"), TEXT("bSerializeDependencies"), Options.bSerializeDependencies);
		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);

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

Scope: file

Source code excerpt:


	/** True rather to load/save registry at all */
	bool bSerializeAssetRegistry = false;

	/** True rather to load/save dependency info. If true this will handle hard and soft package references */
	bool bSerializeDependencies = false;

	/** True rather to load/save dependency info for Name references,  */
	bool bSerializeSearchableNameDependencies = 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
{