PackageReload.EnableFastPath
PackageReload.EnableFastPath
#Overview
name: PackageReload.EnableFastPath
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When \'true\', an optimized codepath is used to speed up reloading packages (experimental).
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PackageReload.EnableFastPath is to enable an optimized codepath for speeding up the reloading of packages in Unreal Engine. This setting is specifically designed for the package reloading system, which is a critical part of the engine’s hot-reloading capabilities.
This setting variable is primarily used in the CoreUObject module of Unreal Engine, specifically within the package reloading system. Based on the callsites, it’s clear that this variable is utilized in the FPackageReferencersHelper class, which is responsible for managing package references during the reloading process.
The value of this variable is set through a console variable (CVarPackageReloadEnableFastPath) defined in the PackageReload.cpp file. It’s initialized with a default value of true, indicating that the fast path is enabled by default.
The associated variable CVarPackageReloadEnableFastPath directly interacts with PackageReload.EnableFastPath. They share the same value and purpose.
Developers must be aware that this variable is only available in editor builds (WITH_EDITOR is defined). It’s an experimental feature, so its behavior might change in future engine versions. Also, enabling or disabling this feature could affect the performance and behavior of package reloading.
Best practices when using this variable include:
- Test thoroughly when enabling or disabling this feature, as it may impact the stability of your project during hot-reloading.
- Monitor performance differences with this feature enabled and disabled to ensure it’s beneficial for your specific use case.
- Be prepared to disable this feature if you encounter any unexpected behavior during package reloading.
Regarding the associated variable CVarPackageReloadEnableFastPath:
- It’s a TAutoConsoleVariable
, which means it can be changed at runtime through console commands. - It’s used to check whether the fast path should be enabled in various parts of the FPackageReferencersHelper class.
- When using this variable, developers should use the GetValueOnAnyThread() method to retrieve its current value, as seen in the provided code snippets.
- Changes to this variable will immediately affect the package reloading behavior, so it should be modified with caution, especially in production environments.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/PackageReload.cpp:17
Scope: file
Source code excerpt:
#if WITH_EDITOR
TAutoConsoleVariable<bool> CVarPackageReloadEnableFastPath(
TEXT("PackageReload.EnableFastPath"),
true,
TEXT("When 'true', an optimized codepath is used to speed up reloading packages (experimental)."),
ECVF_Default);
#endif
class FPackageReferencersHelper
#Associated Variable and Callsites
This variable is associated with another variable named CVarPackageReloadEnableFastPath
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/PackageReload.cpp:16
Scope: file
Source code excerpt:
#if WITH_EDITOR
TAutoConsoleVariable<bool> CVarPackageReloadEnableFastPath(
TEXT("PackageReload.EnableFastPath"),
true,
TEXT("When 'true', an optimized codepath is used to speed up reloading packages (experimental)."),
ECVF_Default);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/PackageReload.cpp:99
Scope (from outer to inner):
file
class class FPackageReferencersHelper
function FPackageReferencersHelper
Source code excerpt:
{
#if WITH_EDITOR
if (CVarPackageReloadEnableFastPath.GetValueOnAnyThread())
{
OnObjectsReplacedHandle = FCoreUObjectDelegates::OnObjectsReplaced.AddRaw(this, &FPackageReferencersHelper::OnObjectsReplaced);
OnObjectConstructedHandle = FCoreUObjectDelegates::OnObjectConstructed.AddRaw(this, &FPackageReferencersHelper::OnObjectConstructed);
// Build list of UObjects that represent the packages about to be reloaded.
TArray<UObject*> ObjectsToReload;
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/PackageReload.cpp:139
Scope (from outer to inner):
file
class class FPackageReferencersHelper
function void ForEachObject
Source code excerpt:
{
#if WITH_EDITOR
if (CVarPackageReloadEnableFastPath.GetValueOnAnyThread())
{
for (TWeakObjectPtr<UObject> Object : PotentialReferencerObjects)
{
UObject* PotentialReferencer = Object.Get();
if (PotentialReferencer != nullptr)
{