UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PackageReload.h File Reference
#include "Containers/Array.h"
#include "Containers/ArrayView.h"
#include "Containers/Map.h"
#include "Containers/SparseArray.h"
#include "CoreMinimal.h"
#include "HAL/Platform.h"
#include "HAL/PlatformCrt.h"
#include "Templates/PointerIsConvertibleFromTo.h"
#include "Templates/UnrealTemplate.h"
#include "UObject/Object.h"
#include "UObject/ObjectPtr.h"
#include "UObject/ObjectMacros.h"
#include "UObject/UObjectGlobals.h"
#include "UObject/WeakObjectPtr.h"
#include "UObject/WeakObjectPtrTemplates.h"

Go to the source code of this file.

Classes

struct  FReloadPackageData
 
class  FPackageReloadedEvent
 

Enumerations

enum class  EPackageReloadPhase : uint8 {
  PrePackageLoad , PrePackageFixup , OnPackageFixup , PostPackageFixup ,
  PreBatch , PostBatchPreGC , PostBatchPostGC
}
 

Functions

COREUOBJECT_API void SortPackagesForReload (TArray< UPackage * > &PackagesToReload)
 
COREUOBJECT_API UPackageReloadPackage (UPackage *InPackageToReload, const uint32 InLoadFlags)
 
COREUOBJECT_API void ReloadPackages (const TArrayView< FReloadPackageData > &InPackagesToReload, TArray< UPackage * > &OutReloadedPackages, const int32 InNumPackagesPerBatch=1)
 

Enumeration Type Documentation

◆ EPackageReloadPhase

enum class EPackageReloadPhase : uint8
strong

Enum describing the phase of the package reload

Enumerator
PrePackageLoad 

Called once for each each package in a batch prior to loading its new version. This phase can be used to discard anything that may be required before the new package is loaded (note: the new package isn't guaranteed to load successfully!).

PrePackageFixup 

Called once for each each package in a batch prior to any object fix-up happening. This phase can be used to make sure that any UI referencing old objects is removed or updated as needed.

OnPackageFixup 

Called once for each each package in a batch prior to automatic fix-up. This phase can be used to fix-up any references that can't automatically be fixed-up (ie, non-uproperty or ARO references).

PostPackageFixup 

Called once for each each package in a batch after all reference fix-up has happened, and before the old package is purged. This phase can be used to finalize the changes made to any objects that were referencing the objects from the old package.

PreBatch 

Called once before a batch starts

PostBatchPreGC 

Called once after a batch has ended, but before GC has run

PostBatchPostGC 

Called once after a batch has ended, and after GC has run

Function Documentation

◆ ReloadPackage()

COREUOBJECT_API UPackage * ReloadPackage ( UPackage InPackageToReload,
const uint32  InLoadFlags 
)

Checks to see if a package has been loaded, and if so, unloads it before loading it again. Does nothing if the package isn't currently loaded.

Parameters
InPackageToReloadPointer to the package to reload (pointer will become invalid if the package is reloaded successfully).
InLoadFlagsFlags controlling loading behavior for the replacement package.
Returns
Reloaded package if successful, null otherwise.

◆ ReloadPackages()

COREUOBJECT_API void ReloadPackages ( const TArrayView< FReloadPackageData > &  InPackagesToReload,
TArray< UPackage * > &  OutReloadedPackages,
const int32  InNumPackagesPerBatch = 1 
)

Given an array of packages, checks to see if each package has been loaded, and if so, unloads it before loading it again. Does nothing if the package isn't currently loaded.

Note
This doesn't re-order the loads to make sure that dependencies are re-loaded first, you must handle that in your calling code (
See also
SortPackagesForReload).
Parameters
InPackagesToReloadArray of packages to reload.
OutReloadedPackagesArray of new package pointers. An entry will be present for every item from InPackagesToReload, however they may be null.
InNumPackagesPerBatchThe number of packages to process before running a pointer fix-up and GC. More packages per-batch will process faster, but consume more memory.

◆ SortPackagesForReload()

COREUOBJECT_API void SortPackagesForReload ( TArray< UPackage * > &  PackagesToReload)

Given an array of packages, sort them so that dependencies will be processed before the packages that depend on them.

Parameters
PackagesToReloadArray of packages to sort. Will be replaced with the sorted data.