UPackage

A package.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/UObject/Package.h

Include

#include "UObject/Package.h"

Syntax

class UPackage : public UObject

Remarks

A package.

Variables

Name Description

Public variable

uint8: 1

 

bCanBeImported

Whether this package can be imported, i.e. its package name is a package that exists on disk.

Public variable

uint8: 1

 

bHasBeenFullyLoaded

Whether this package has been fully loaded (aka had all it's exports created) at some point.

Public variable

uint8: 1

 

bIsCookedForEditor

True if this packages has been cooked for the editor / opened cooked by the editor

Public variable

TArray< UFuncti...

 

Delegates

Link list of delegates registered to the package. The next pointer chain can't be used for this.

Public variable

uint64

 

FileSize

Size of the file for this package; if the package was not loaded from a file or was a forced export in another package, this will be zero

Public variable

FCustomVersionC...

 

LinkerCustomVersion

Linker custom version container this package has been serialized with.

Public variable

int32

 

LinkerLicenseeVersion

Linker licensee version this package has been serialized with. This is mostly used by PostLoad

Public variable

FLinkerLoad ...

 

LinkerLoad

Linker load associated with this package

Public variable

FPackageFileVer...

 

LinkerPackageVersion

Linker package version this package has been serialized with. This is mostly used by PostLoad

Public variable

UMetaData *

 

MetaData

MetaData for the editor, or NULL in the game.

Public variable

int32

 

PIEInstanceID

Editor only: PIE instance ID this package belongs to, INDEX_NONE otherwise

Public variable

TUniquePtr< FTh...

 

ThumbnailMap

Editor only: Thumbnails stored in this package

Public variable

TUniquePtr< FWo...

 

WorldTileInfo

World browser information.

Constructors

Name Description

Public function

UPackage

(
    FVTableHelper& Helper
)

DO NOT USE. This constructor is for internal usage only for hot-reload purposes.

Public function

UPackage

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Static

void

 

__DefaultConstructor

(
    const FObjectInitializer& X
)

Public function Static

UObject *...

 

__VTableCtorCaller

(
    FVTableHelper& Helper
)

Public function

FThumbnailMa...

 

AccessThumbnailMap()

Access the thumbnail map for this package. Only call this if HasThumbnailMap returns true!

Public function Const

bool

 

CanBeImported()

Returns whether the package can be imported.

Public function

void

 

ClearDirtyFlag()

Clear the package dirty flag without any transaction tracking

Public function

void

 

ClearPackageFlags

(
    uint32 NewFlags
)

Set the specified flags to false. Does not affect any other flags.

Public function Const

bool

 

ContainsMap()

Returns whether this package contains a ULevel or UWorld object.

Public function Const

UObject *...

 

FindAssetInPackage

(
    EObjectFlags RequiredTopLevelFlags
)

Utility function to find Asset in this package, if any

Public function

void

 

FullyLoad()

Fully loads this package. Safe to call multiple times and won't clobber already loaded assets.

Public function Const

const TArray...

 

GetChunkIDs()

Returns our ChunkIDs

Public function Const

TArray< UPac...

 

GetExternalPackages()

Return the list of packages found assigned to object outer-ed to the top level objects of this package

Public function

int64

 

GetFileSize()

Returns our FileSize

Public function Const

FName

 

GetFolderName()

Get the package's folder name

Public function Const

bool

 

GetHasBeenEndLoaded()

Public function Const

const FPacka...

 

GetLoadedPath()

Get the path this package was loaded from; may be different than packagename, and may not be set if the package was not loaded from disk

Public function

float

 

GetLoadTime()

Returns the time it took the last time this package was fully loaded, 0 otherwise.

Public function

UMetaData &#...

 

GetMetaData()

Gets (after possibly creating) a metadata object for this package

Public function Const

uint32

 

GetPackageFlags()

Gets the package flags.

Public function Const

FPackageId

 

GetPackageId()

Returns the unique package id

Public function Const

FPackageId

 

GetPackageIdToLoad()

Returns the unique package id to load

Public function Const

FGuid

 

GetPersistentGuid()

Returns our persistent Guid

Public function Const

const FThumb...

 

GetThumbnailMap()

Returns the thumbnail map for this package (const).

Public function Const

bool

 

HasAllPackagesFlags

(
    uint32 FlagsToCheck
)

Used to safely check whether all of the passed in flags are set.

Public function Const

bool

 

HasAnyPackageFlags

(
    uint32 FlagsToCheck
)

Used to safely check whether the passed in flag is set.

Public function Const

bool

 

HasThumbnailMap()

Returns true if this package has a thumbnail map

Public function Const

bool

 

IsDirty()

Returns whether the package needs to be saved.

Public function Static

bool

 

IsEmptyPackage

(
    UPackage* Package,
    const UObject* LastReferencer
)

Determines if a package contains no more assets.

Public function Const

bool

 

IsFullyLoaded()

Returns whether the package is fully loaded.

Public function Const

bool

 

IsLoadedByEditorPropertiesOnly()

Returns true when the package is only referenced by editor-only flag

Public function

void

 

MarkAsFullyLoaded()

Marks this package as being fully loaded.

Public function Const

bool

 

RequiresLocalizationGather()

Returns whether this package contains data required to be gathered for localization.

Public function Static

FSavePackage...

 

Save

(
    UPackage* InOuter,
    UObject* InAsset,
    const TCHAR* Filename,
    const FSavePackageArgs& SaveArgs
)

Save one specific object (along with any objects it references contained within the same Outer) into an Unreal package.

Public function Static

ESavePackage...

 

SaveConcurrent

(
    TArrayView< FPackageSaveInfo > InPa...,
    const FSavePackageArgs& SaveArgs,
    TArray< FSavePackageResultStruct > ...
)

Save a list of packages concurrently using Save2 mechanism SaveConcurrent is currently experimental and shouldn't be used until it can safely replace Save.

Public function Static

bool

 

SavePackage

(
    UPackage* InOuter,
    UObject* InAsset,
    const TCHAR* Filename,
    const FSavePackageArgs& SaveArgs
)

Save one specific object (along with any objects it references contained within the same Outer) into an Unreal package.

Public function

void

 

SetCanBeImportedFlag

(
    bool bInCanBeImported
)

Marks/Unmarks the package's bCanBeImported flag.

Public function

void

 

SetChunkIDs

(
    const TArray< int32 >& InChunkIDs
)

Sets our ChunkIDs

Public function

void

 

SetDirtyFlag

(
    bool bIsDirty
)

Marks/Unmarks the package's bDirty flag, save the package to the transaction buffer if a transaction is ongoing

Public function

void

 

SetFolderName

(
    FName name
)

Set the package's folder name

Public function

void

 

SetHasBeenEndLoaded

(
    bool bValue
)

Public function

void

 

SetLoadedByEditorPropertiesOnly

(
    bool bIsEditorOnly,
    bool bRecursive
)

Sets the bLoadedByEditorPropertiesOnly flag

Public function

void

 

SetLoadedPath

(
    const FPackagePath& PackagePath
)

Set the path this package was loaded from; typically called only by the linker during load

Public function

void

 

SetLoadTime

(
    float InLoadTime
)

Sets the time it took to load this package.

Public function

void

 

SetPackageFlags

(
    uint32 NewFlags
)

Set the specified flags to true. Does not affect any other flags.

Public function

void

 

SetPackageFlagsTo

(
    uint32 NewFlags
)

Public function

void

 

SetPackageId

(
    FPackageId InPackageId
)

Sets the unique package id

Public function

void

 

SetPersistentGuid

(
    FGuid NewPersistentGuid
)

Sets a specific persistent Guid

Public function Static

UClass *

 

StaticClass()

Returns a UClass object representing this class at runtime

Public function Static

EClassCastFl...

 

StaticClassCastFlags()

Returns the static cast flags for this class

Public function Static

const TCHAR ...

 

StaticPackage()

Returns the package this class belongs in

Public function Static

void

 

StaticRegisterNativesUPackage()

Public function

void

 

ThisContainsMap()

Called to indicate that this package contains a ULevel or UWorld object.

Public function

void

 

ThisRequiresLocalizationGather

(
    bool Value
)

Called to indicate that this package contains data required to be gathered for localization.

Public function Static

void

 

WaitForAsyncFileWrites()

Wait for any SAVE_Async file writes to complete

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual Const

bool

 

IsAsset()

Packages are never assets

Public function Virtual Const

bool

 

IsDestructionThreadSafe()

Called during garbage collection to determine if an object can have its destructor called on a worker thread.

Public function Virtual Const

bool

 

IsNameStableForNetworking()

IsNameStableForNetworking means an object can be referred to its path name (relative to outer) over the network

Public function Virtual Const

bool

 

IsPostLoadThreadSafe()

Called during async load to determine if PostLoad can be called on the loading thread.

Public function Virtual Const

bool

 

NeedsLoadForClient()

Called during saving to determine the load flags to save with the object.

Public function Virtual Const

bool

 

NeedsLoadForServer()

Called during saving to determine the load flags to save with the object.

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, but before the config has been loaded, etc.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Serializer

Public function Virtual

void

 

TagSubobjects

(
    EObjectFlags NewFlags
)

Tags the Package's metadata

Tags generated objects with flags

Operators

Name Description

Public function

void

 

operator delete

(
    void* InMem
)

Eliminate V1062 warning from PVS-Studio while keeping MSVC and Clang happy.

Public function

void *

 

operator new

(
    const size_t InSize,
    EInternal InInternalOnly,
    UObject* InOuter,
    FName InName,
    EObjectFlags InSetFlags
)

For internal use only; use StaticConstructObject() to create new objects.

Public function

void *

 

operator new

(
    const size_t InSize,
    EInternal* InMem
)

For internal use only; use StaticConstructObject() to create new objects.

Typedefs

Name

Description

FOnPackageDirtyStateChanged

Delegate type for package dirty state events. ( Params: UPackage* ModifiedPackage )

FOnPackageMarkedDirty

Delegate type for when a package is marked as dirty via UObjectBaseUtilty::MarkPackageDirty ( Params: UPackage* ModifiedPackage, bool bWasDirty )

FOnPackageSaved

Delegate type for package saved events ( Params: const FString& PackageFileName, UObject* Outer )

FOnPackageSavedWithContext

Delegate type for package saved events ( Params: const FString& PackageFileName, UObject* Outer, FObjectPostSaveContext ObjectSaveContext )

FPreSavePackage

Delegate type for when a package is about to be saved

FPreSavePackageWithContext

Delegate type for when a package is about to be saved

Super

Typedef for the base class (UObject)

ThisClass

Typedef for UPackage.

Constants

Name

Description

EditorPackage

UE-21181 - trying to track when a flag gets set on a package due to PIE.

PackageDirtyStateChangedEvent

Delegate to notify subscribers when the dirty state of a package is changed.

PackageMarkedDirtyEvent

Delegate to notify subscribers when a package is marked as dirty via UObjectBaseUtilty::MarkPackageDirty

PackageSavedEvent

PackageSavedWithContextEvent

Delegate to notify subscribers when a package has been saved.

PreSavePackageEvent

PreSavePackageWithContextEvent

Delegate to notify subscribers when a package is about to be saved.

StaticClassFlags

Bitwise union of EClassFlags pertaining to this class.

Deprecated Variables

Name Description

Public variable

FName

 

FileName

Use GetLoadedPath instead

Deprecated Functions

Name Description

Public function Const

FGuid

 

GetGuid()

UPackage::Guid has not been used by the engine for a long time and GetGuid will be removed.

Public function

FGuid

 

MakeNewGuid()

UPackage::Guid has not been used by the engine for a long time and MakeNewGuid will be removed.

Public function Static

FSavePackage...

 

Save

(
    UPackage* InOuter,
    UObject* Base,
    EObjectFlags TopLevelFlags,
    const TCHAR* Filename,
    FOutputDevice* Error,
    FLinkerNull* Conform,
    bool bForceByteSwapping,
    bool bWarnOfLongFilename,
    uint32 SaveFlags,
    const ITargetPlatform* TargetP...,
    const FDateTime& FinalTimeStamp,
    bool bSlowTask,
    FArchiveDiffMap* InOutDiffMap,
    FSavePackageContext* SavePacka...
)

Pack the arguments into FSavePackageArgs and call the function overload that takes FSavePackageArgs.

Public function Static

bool

 

SavePackage

(
    UPackage* InOuter,
    UObject* Base,
    EObjectFlags TopLevelFlags,
    const TCHAR* Filename,
    FOutputDevice* Error,
    FLinkerNull* Conform,
    bool bForceByteSwapping,
    bool bWarnOfLongFilename,
    uint32 SaveFlags,
    const ITargetPlatform* TargetP...,
    const FDateTime& FinalTimeStamp,
    bool bSlowTask
)

Pack the arguments into FSavePackageArgs and call the function overload that takes FSavePackageArgs.

Public function

void

 

SetGuid

(
    FGuid NewGuid
)

UPackage::Guid has not been used by the engine for a long time and SetGuid will be removed.