UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::SavePackageUtilities Namespace Reference

Namespaces

namespace  Private
 

Classes

struct  FObjectStatus
 
class  FPackageBackupUtility
 
struct  FPreloadDependency
 
struct  FRealmInstigator
 

Typedefs

using FEDLMessageCallback = TFunction< void(ELogVerbosity::Type, FStringView)>
 
using FEDLLogRecordCallback = TFunction< void(UE::FLogRecord &&Record)>
 

Enumerations

enum class  EEditorOnlyObjectFlags { None = 0 , CheckRecursive = 1 << 1 , ApplyHasNonEditorOnlyReferences = 1 << 2 }
 

Functions

EObjectMark GetExcludedObjectMarksForTargetPlatform (const class ITargetPlatform *TargetPlatform)
 
void FindMostLikelyCulprit (const TArray< UObject * > &BadObjects, FSaveContext &SaveContext, ESaveRealm HarvestedRealm, UObject *&OutMostLikelyCulprit, UObject *&OutReferencer, const FProperty *&OutReferencerProperty, bool &OutIsCulpritArchetype, FString &OutDiagnosticText)
 
ESavePackageResult FinalizeTempOutputFiles (const FPackagePath &PackagePath, const FSavePackageOutputFileArray &OutputFiles, const FDateTime &FinalTimeStamp)
 
void WriteToFile (const FString &Filename, const uint8 *InDataPtr, int64 InDataSize)
 
void AsyncWriteFile (FLargeMemoryPtr Data, const int64 DataSize, const TCHAR *Filename, EAsyncWriteOptions Options, TArrayView< const FFileRegion > InFileRegions)
 
void AsyncWriteFile (EAsyncWriteOptions Options, FSavePackageOutputFile &File)
 
void GetCDOSubobjects (UObject *CDO, TArray< UObject * > &Subobjects)
 
bool IsUpdatingLoadedPath (bool bIsCooking, const FPackagePath &TargetPackagePath, uint32 SaveFlags)
 
bool IsProceduralSave (bool bIsCooking, const FPackagePath &TargetPackagePath, uint32 SaveFlags)
 
void CallPreSave (UObject *Object, FObjectSaveContextData &ObjectSaveContext)
 
void CallPreSaveRoot (UObject *Object, FObjectSaveContextData &ObjectSaveContext)
 
void CallPostSaveRoot (UObject *Object, FObjectSaveContextData &ObjectSaveContext, bool bNeedsCleanup)
 
EObjectFlags NormalizeTopLevelFlags (EObjectFlags TopLevelFlags, bool bIsCooking)
 
void IncrementOutstandingAsyncWrites ()
 
void DecrementOutstandingAsyncWrites ()
 
void ResetCookStats ()
 
int32 GetNumPackagesSaved ()
 
EObjectMark GetExcludedObjectMarksForTargetPlatform (const ITargetPlatform *TargetPlatform)
 
template<typename HashBuilderType >
bool TryHashFile (FStringView Filename, HashBuilderType &Builder, int64 Offset=0, int64 Size=-1)
 
 ENUM_CLASS_FLAGS (EEditorOnlyObjectFlags)
 
void HarvestCookRuntimeDependencies (FObjectSaveContextData &Data, UObject *HarvestReferencesFrom)
 
bool CanSkipEditorReferencedPackagesWhenCooking ()
 

Variables

const FName NAME_World ("World")
 
const FName NAME_Level ("Level")
 
const FName NAME_PrestreamPackage ("PrestreamPackage")
 

Typedef Documentation

◆ FEDLLogRecordCallback

◆ FEDLMessageCallback

Enumeration Type Documentation

◆ EEditorOnlyObjectFlags

Enumerator
None 
CheckRecursive 
ApplyHasNonEditorOnlyReferences 

Function Documentation

◆ AsyncWriteFile() [1/2]

void UE::SavePackageUtilities::AsyncWriteFile ( EAsyncWriteOptions  Options,
FSavePackageOutputFile File 
)

◆ AsyncWriteFile() [2/2]

void UE::SavePackageUtilities::AsyncWriteFile ( FLargeMemoryPtr  Data,
const int64  DataSize,
const TCHAR Filename,
EAsyncWriteOptions  Options,
TArrayView< const FFileRegion InFileRegions 
)

◆ CallPostSaveRoot()

COREUOBJECT_API void UE::SavePackageUtilities::CallPostSaveRoot ( UObject Object,
FObjectSaveContextData ObjectSaveContext,
bool  bCleanupRequired 
)

Call the PostSaveRoot function on the given object.

◆ CallPreSave()

COREUOBJECT_API void UE::SavePackageUtilities::CallPreSave ( UObject Object,
FObjectSaveContextData ObjectSaveContext 
)

Call the PreSave function on the given object and log a warning if there is an incorrect override.

◆ CallPreSaveRoot()

COREUOBJECT_API void UE::SavePackageUtilities::CallPreSaveRoot ( UObject Object,
FObjectSaveContextData ObjectSaveContext 
)

Call the PreSaveRoot function on the given object.

◆ CanSkipEditorReferencedPackagesWhenCooking()

bool UE::SavePackageUtilities::CanSkipEditorReferencedPackagesWhenCooking ( )
inline

◆ DecrementOutstandingAsyncWrites()

COREUOBJECT_API void UE::SavePackageUtilities::DecrementOutstandingAsyncWrites ( )

◆ ENUM_CLASS_FLAGS()

UE::SavePackageUtilities::ENUM_CLASS_FLAGS ( EEditorOnlyObjectFlags  )

◆ FinalizeTempOutputFiles()

ESavePackageResult UE::SavePackageUtilities::FinalizeTempOutputFiles ( const FPackagePath PackagePath,
const FSavePackageOutputFileArray OutputFiles,
const FDateTime FinalTimeStamp 
)

Search 'OutputFiles' for output files that were saved to the temp directory and move those files to their final location. Output files that were not saved to the temp directory will be ignored.

If errors are encountered then the original state of the package will be restored and should continue to work.

◆ FindMostLikelyCulprit()

void UE::SavePackageUtilities::FindMostLikelyCulprit ( const TArray< UObject * > &  BadObjects,
FSaveContext SaveContext,
ESaveRealm  HarvestedRealm,
UObject *&  OutMostLikelyCulprit,
UObject *&  OutReferencer,
const FProperty *&  OutReferencerProperty,
bool OutIsCulpritArchetype,
FString &  OutDiagnosticText 
)

Find the most likely culprit that caused the objects in the passed in array to be considered illegal for saving.

Parameters
BadObjectsArray of objects that are considered "bad" (e.g. non- RF_Public, in different map package, ...)
SaveContextSaveContext for the SavePackage call.
HarvestedRealmWhich realm encountered the BadObjects.
OutMostLikelyCulpritUObject that is considered the most likely culprit causing the "bad" objects to be referenced or NULL
OutReferencerUObject referencing the most likely culprit
OutReferencerPropertyProperty (belonging to referencer) storing the offending reference
OutIsCulpritArchetypeIs the most likely culprit an archetype object

◆ GetCDOSubobjects()

void UE::SavePackageUtilities::GetCDOSubobjects ( UObject CDO,
TArray< UObject * > &  Subobjects 
)

For a CDO get all of the subobjects templates nested inside it or it's class

◆ GetExcludedObjectMarksForTargetPlatform() [1/2]

EObjectMark UE::SavePackageUtilities::GetExcludedObjectMarksForTargetPlatform ( const class ITargetPlatform TargetPlatform)

Determines the set of object marks that should be excluded for the target platform

Parameters
TargetPlatformThe platform being saved for, or null for saving platform-agnostic version
Returns
Excluded object marks specific for the particular target platform, objects with any of these marks will be rejected from the cook

◆ GetExcludedObjectMarksForTargetPlatform() [2/2]

EObjectMark UE::SavePackageUtilities::GetExcludedObjectMarksForTargetPlatform ( const ITargetPlatform TargetPlatform)

◆ GetNumPackagesSaved()

COREUOBJECT_API int32 UE::SavePackageUtilities::GetNumPackagesSaved ( )

◆ HarvestCookRuntimeDependencies()

void UE::SavePackageUtilities::HarvestCookRuntimeDependencies ( FObjectSaveContextData Data,
UObject HarvestReferencesFrom 
)

◆ IncrementOutstandingAsyncWrites()

COREUOBJECT_API void UE::SavePackageUtilities::IncrementOutstandingAsyncWrites ( )

◆ IsProceduralSave()

COREUOBJECT_API bool UE::SavePackageUtilities::IsProceduralSave ( bool  bIsCooking,
const FPackagePath TargetPackagePath,
uint32  SaveFlags 
)

Return whether the given save parameters indicate the package is a procedural save. Any save without the the possibility of user-generated edits to the package is a procedural save (Cooking, EditorDomain). This allows us to execute transforms that only need to be executed in response to new user data.

◆ IsUpdatingLoadedPath()

COREUOBJECT_API bool UE::SavePackageUtilities::IsUpdatingLoadedPath ( bool  bIsCooking,
const FPackagePath TargetPackagePath,
uint32  SaveFlags 
)

Return whether the given save parameters indicate the LoadedPath of the package being saved should be updated. This allows us to update the in-memory package when it is saved in editor to match its new save file.

◆ NormalizeTopLevelFlags()

COREUOBJECT_API EObjectFlags UE::SavePackageUtilities::NormalizeTopLevelFlags ( EObjectFlags  TopLevelFlags,
bool  bIsCooking 
)

Add any required TopLevelFlags based on the save parameters.

◆ ResetCookStats()

COREUOBJECT_API void UE::SavePackageUtilities::ResetCookStats ( )

◆ TryHashFile()

bool UE::SavePackageUtilities::TryHashFile ( FStringView  Filename,
HashBuilderType Builder,
int64  Offset = 0,
int64  Size = -1 
)

◆ WriteToFile()

void UE::SavePackageUtilities::WriteToFile ( const FString &  Filename,
const uint8 InDataPtr,
int64  InDataSize 
)

Variable Documentation

◆ NAME_Level

const FName UE::SavePackageUtilities::NAME_Level ( "Level"  )

◆ NAME_PrestreamPackage

const FName UE::SavePackageUtilities::NAME_PrestreamPackage ( "PrestreamPackage"  )

◆ NAME_World

const FName UE::SavePackageUtilities::NAME_World ( "World"  )