Serialization.LoadFromSidecar
Serialization.LoadFromSidecar
#Overview
name: Serialization.LoadFromSidecar
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true FEditorBulkData will load from the sidecar file
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Serialization.LoadFromSidecar is to control whether FEditorBulkData should load data from a sidecar file instead of the default package file. This setting is part of Unreal Engine’s serialization system, specifically related to bulk data handling in the editor.
This setting variable is primarily used in the CoreUObject module, specifically within the UE::Serialization namespace. It affects the behavior of FEditorBulkData, which is responsible for handling large data assets in the Unreal Editor.
The value of this variable is set through a console variable (CVar) system. It’s defined as a static TAutoConsoleVariable
This variable interacts closely with other serialization-related variables and functions, such as CVarShouldLoadFromTrailer and HasPayloadSidecarFile(). It’s often used in conjunction with these to determine the appropriate data loading method.
Developers must be aware that this is an experimental feature, as indicated by the comment in the source code. It’s not expected to be used in production environments. Using this feature may impact performance and stability, so it should be used cautiously and only for specific development or debugging purposes.
Best practices when using this variable include:
- Only enable it for specific development or debugging scenarios.
- Ensure that sidecar files are properly set up and accessible when enabling this feature.
- Monitor performance and stability when this feature is enabled, as it may impact the editor’s behavior.
- Disable it before building for production or shipping the game.
Regarding the associated variable CVarShouldLoadFromSidecar:
The purpose of CVarShouldLoadFromSidecar is to provide runtime control over the Serialization.LoadFromSidecar setting. It’s the actual console variable that stores and provides access to the setting’s value.
This variable is used in the CoreUObject module, specifically within the FEditorBulkData class to determine whether to load data from a sidecar file.
The value of CVarShouldLoadFromSidecar is set when the console variable is initialized or when it’s changed through the console or configuration files.
It interacts directly with the Serialization.LoadFromSidecar setting and is used in conjunction with other checks like HasPayloadSidecarFile() to determine the data loading behavior.
Developers should be aware that this variable’s value can be accessed from any thread using the GetValueOnAnyThread() method, which may have implications for thread safety in certain scenarios.
Best practices for using CVarShouldLoadFromSidecar include:
- Access its value using GetValueOnAnyThread() when needed in runtime code.
- Consider the performance implications of frequently checking this value in performance-critical code paths.
- Use it in conjunction with other checks (like HasPayloadSidecarFile()) to ensure correct behavior when loading from sidecar files.
- Remember that changing this value at runtime will affect the behavior of FEditorBulkData loading, which could have wide-ranging effects on editor functionality.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/EditorBulkData.cpp:50
Scope (from outer to inner):
file
namespace UE::Serialization
Source code excerpt:
/** This is an experimental code path and is not expected to be used in production! */
static TAutoConsoleVariable<bool> CVarShouldLoadFromSidecar(
TEXT("Serialization.LoadFromSidecar"),
false,
TEXT("When true FEditorBulkData will load from the sidecar file"));
/**
* Prefer loading from the package trailer (load the trailer, parse the look up, then load the payload) over
* using the in built OffsetInFile member to load from the package file directly.
#Associated Variable and Callsites
This variable is associated with another variable named CVarShouldLoadFromSidecar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/EditorBulkData.cpp:49
Scope (from outer to inner):
file
namespace UE::Serialization
Source code excerpt:
{
/** This is an experimental code path and is not expected to be used in production! */
static TAutoConsoleVariable<bool> CVarShouldLoadFromSidecar(
TEXT("Serialization.LoadFromSidecar"),
false,
TEXT("When true FEditorBulkData will load from the sidecar file"));
/**
* Prefer loading from the package trailer (load the trailer, parse the look up, then load the payload) over
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/EditorBulkData.cpp:1276
Scope (from outer to inner):
file
namespace UE::Serialization
function FCompressedBuffer FEditorBulkData::LoadFromDisk
Source code excerpt:
}
if (HasPayloadSidecarFile() && CVarShouldLoadFromSidecar.GetValueOnAnyThread())
{
return LoadFromSidecarFile();
}
else if (!CanLoadDataFromDisk())
{
if (IsReferencingOldBulkData())
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/EditorBulkData.cpp:2168
Scope (from outer to inner):
file
namespace UE::Serialization
function bool FEditorBulkData::LocationMatches
Source code excerpt:
return false;
}
if ((HasPayloadSidecarFile() && CVarShouldLoadFromSidecar.GetValueOnAnyThread()) ||
CVarShouldLoadFromTrailer.GetValueOnAnyThread())
{
// Loading from the SidecarFile or PackageTrailer uses the PayloadContentId as
// the identifier to look up the location in the file
return PayloadContentId == Other.PayloadContentId;
}