Serialization.ApplyBulkDataOffsetFix
Serialization.ApplyBulkDataOffsetFix
#Overview
name: Serialization.ApplyBulkDataOffsetFix
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true, we will try to fix potentially bad bulkdata offsets
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Serialization.ApplyBulkDataOffsetFix is to fix potentially bad bulk data offsets during serialization in Unreal Engine 5. This setting variable is primarily used in the serialization system, specifically for handling bulk data.
The CoreUObject module relies on this setting variable, as evidenced by its usage in the LinkerLoad.cpp file within the Runtime/CoreUObject/Private/UObject directory.
The value of this variable is set using a TAutoConsoleVariable, which means it can be changed at runtime through console commands. By default, it is set to true.
This variable interacts with CVarApplyBulkDataFix, which is the associated console variable that shares the same value. They are essentially two ways to access the same setting.
Developers must be aware that this variable affects how the engine handles bulk data offsets during serialization. When enabled (set to true), the engine will attempt to fix potentially bad bulk data offsets. This can be crucial for ensuring correct data loading and preventing corruption issues.
Best practices when using this variable include:
- Generally keeping it enabled (true) to benefit from the automatic offset fixing.
- Only disabling it if specific issues arise that are traced back to this fix.
- Being cautious when modifying this setting in a production environment, as it could affect data integrity.
Regarding the associated variable CVarApplyBulkDataFix:
The purpose of CVarApplyBulkDataFix is to provide a console-accessible way to toggle the bulk data offset fix. It serves the same function as Serialization.ApplyBulkDataOffsetFix but can be more easily manipulated through console commands.
This console variable is used in the CoreUObject module, specifically in the FLinkerLoad class when serializing bulk data.
The value of CVarApplyBulkDataFix is set using the TAutoConsoleVariable constructor, with a default value of true.
CVarApplyBulkDataFix interacts directly with Serialization.ApplyBulkDataOffsetFix, as they represent the same setting.
Developers should be aware that changing this console variable at runtime will immediately affect how bulk data is handled during serialization.
Best practices for using CVarApplyBulkDataFix include:
- Using it for debugging purposes when investigating serialization issues.
- Documenting any changes made to this variable during development or testing.
- Ensuring that the value is set back to true before building final release versions of the game or application.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp:197
Scope: file
Source code excerpt:
*/
static TAutoConsoleVariable<bool> CVarApplyBulkDataFix(
TEXT("Serialization.ApplyBulkDataOffsetFix"),
true,
TEXT("When true, we will try to fix potentially bad bulkdata offsets"));
/**
* Test whether the given package index is a valid import or export in this package
*/
#Associated Variable and Callsites
This variable is associated with another variable named CVarApplyBulkDataFix
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp:196
Scope: file
Source code excerpt:
* unintended problems so that it can be disabled quickly.
*/
static TAutoConsoleVariable<bool> CVarApplyBulkDataFix(
TEXT("Serialization.ApplyBulkDataOffsetFix"),
true,
TEXT("When true, we will try to fix potentially bad bulkdata offsets"));
/**
* Test whether the given package index is a valid import or export in this package
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp:7096
Scope (from outer to inner):
file
function UObject* FLinkerLoad::CreateExport
function bool FLinkerLoad::SerializeBulkData
Source code excerpt:
if (Meta.HasAnyFlags(BULKDATA_WorkspaceDomainPayload) == false)
{
if (CVarApplyBulkDataFix.GetValueOnAnyThread())
{
// In theory we should never see the 'BULKDATA_NoOffsetFixUp' flag at this point, but for a time there was a bug that allowed
// packages saved to the workspace domain to have the flag so we cannot assume that the offset is relative and need to check.
// The outcome of this bug actually changed in the 'EUnrealEngineObjectUE5Version::DATA_RESOURCES' refactor which makes the
// following checks more involved.