PackageReload.EnableFastPath

PackageReload.EnableFastPath

#Overview

name: PackageReload.EnableFastPath

This variable is created as a Console Variable (cvar).

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:

  1. Test thoroughly when enabling or disabling this feature, as it may impact the stability of your project during hot-reloading.
  2. Monitor performance differences with this feature enabled and disabled to ensure it’s beneficial for your specific use case.
  3. Be prepared to disable this feature if you encounter any unexpected behavior during package reloading.

Regarding the associated variable CVarPackageReloadEnableFastPath:

#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)
				{