Language:
Discover
By Skill Level
By Category

UAssetManager

Choose your OS:

Inheritance Hierarchy

Syntax

class UAssetManager : public UObject

Remarks

A singleton UObject that is responsible for loading and unloading PrimaryAssets, and maintaining game-specific asset references Games should override this class and change the class reference

Variables

Name Description

Protected variable

TArray < FString ...

 

AlreadyScannedDirectories

List of directories that have already been synchronously scanned

Protected variable

TMap < FName , FP ...

 

AssetPathMap

WITH_EDITOR.

Protected variable

TMap < FName , FN ...

 

AssetPathRedirects

Protected variable

TMap < FPrimaryA ...

 

AssetRuleOverrides

Overridden asset management data for specific types

Protected variable

bool

 

bIncludeOnlyOnDiskAssets

True if only on-disk assets should be searched by the asset registry

Protected variable

bool

 

bIsBulkScanning

True if we are currently in bulk scanning mode

Protected variable

bool

 

bIsGlobalAsyncScanEnvironment

True if we are running a build that is already scanning assets globally so we can perhaps avoid scanning paths synchronously

Protected variable

bool

 

bIsLoadingFromPakFiles

True if we are loading from pak files

Protected variable

bool

 

bIsManagementDatabaseCurrent

True if the asset management database is up to date

Protected variable

bool

 

bOnlyCookProductionAssets

If true, DevelopmentCook assets will error when they are cooked

Protected variable

bool

 

bShouldAcquireMissingChunksOnLoad

True if the chunk install interface should be queries before loading assets

Protected variable

bool

 

bShouldGuessTypeAndName

True if PrimaryAssetType/Name will be implied for loading assets that don't have it saved on disk.

Protected variable

bool

 

bShouldUseSynchronousLoad

True if we should always use synchronous loads, this speeds up cooking

Protected variable

bool

 

bUpdateManagementDatabaseAfterScan

True if the asset management database should be updated after scan completes

Protected variable

TMap < FPrimaryA ...

 

CachedAssetBundles

Cached map of asset bundles, global and per primary asset

Protected variable

FDelegateHandle

 

ChunkInstallDelegateHandle

Delegate bound to chunk install

Protected variable

TMap < FPrimaryA ...

 

ManagementParentMap

Map from PrimaryAssetId to list of PrimaryAssetIds that are the parent of this one, for determining chunking/cooking

Protected variable

int32

 

NumberOfSpawnedNotifications

Number of notifications seen in this update

Protected variable

TArray < UObject ...

 

ObjectReferenceList

List of UObjects that are being kept from being GCd, derived from the asset type map.

Protected variable

TArray < FPendin ...

 

PendingChunkInstalls

List of chunk installs that are being waited for

Protected variable

TMap < FString , ...

 

PrimaryAssetIdRedirects

Protected variable

TMap < FPrimaryA ...

 

PrimaryAssetStateBeforePIE

Copy of the asset state before PIE was entered, return to that when PIE completes

Protected variable

TMap < FName , FN ...

 

PrimaryAssetTypeRedirects

Redirector maps loaded out of AssetMigrations.ini

Protected variable

FStreamableMana ...

 

StreamableManager

The streamable manager used for all primary asset loading

Constructors

Name Description

Public function

UAssetManager()

Constructor

Functions

Name Description

Protected function Virtual

void

 

AcquireChunkList

(
    const TArray < int32 >& ChunkList,
    FAssetManagerAcquireResourceDelegat ...,
    EChunkPriority::Type Priority,
    TSharedPtr < FStreamableHandle > Sta...
)

Call to start acquiring a list of chunks

Public function Virtual

void

 

AcquireResourcesForAssetList

(
    const TArray < FSoftObjectPath >& A...,
    FAssetManagerAcquireResourceDelegat ...,
    EChunkPriority::Type Priority
)

Acquires a set of chunks using the platform chunk layer, then calls the passed in callback

Public function Virtual

void

 

AcquireResourcesForPrimaryAssetList

(
    const TArray < FPrimaryAssetId >& P...,
    FAssetManagerAcquireResourceDelegat ...,
    EChunkPriority::Type Priority
)

Acquires a set of chunks using the platform chunk layer, then calls the passed in callback.

Public function Virtual

bool

 

AddDynamicAsset

(
    const FPrimaryAssetId & PrimaryAsse...,
    const FSoftObjectPath & AssetPath,
    const FAssetBundleData & BundleData
)

Adds or updates a Dynamic asset, which is a runtime-specified asset that has no on disk representation, so has no FAssetData .

Public function Virtual

void

 

ApplyPrimaryAssetLabels()

Handles applying Asset Labels and should be overridden to do any game-specific labelling

Public function Virtual

TSharedPtr < ...

 

ChangeBundleStateForMatchingPrimaryAssets

(
    const TArray < FName >& NewBundles,
    const TArray < FName >& OldBundles,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority
)

Changes the bundle state of all loaded primary assets.

Public function Virtual

TSharedPtr < ...

 

ChangeBundleStateForPrimaryAssets

(
    const TArray < FPrimaryAssetId >& A...,
    const TArray < FName >& AddBundles,
    const TArray < FName >& RemoveBundl...,
    bool bRemoveAllBundles,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority
)

Changes the bundle state of a set of loaded primary assets.

Public function Static

void

 

DumpAssetRegistryInfo()

Dumps information about the Asset Registry to log

Public function Static

void

 

DumpAssetTypeSummary()

Dumps out summary of managed types to log

Public function Static

void

 

DumpLoadedAssetState()

Dumps out list of loaded asset bundles to log

Public function Static

void

 

DumpReferencersForPackage

(
    const TArray < FString >& PackageNa...
)

Dumps out list of primary asset -> managed assets to log

Protected function Virtual

void

 

EndPIE

(
    bool bStartSimulate
)

Called after PIE ends, resets loading state

Public function Virtual

FPrimaryAsse ...

 

ExtractPrimaryAssetIdFromData

(
    const FAssetData & AssetData,
    FPrimaryAssetType SuggestedType
)

GENERAL ASSET UTILITY FUNCTIONS.

Public function Virtual

void

 

ExtractSoftObjectPaths

(
    const UStruct * Struct,
    const void* StructValue,
    TArray < FSoftObjectPath >& FoundAs...,
    const TArray < FName >& PropertiesT...
)

Extracts all FSoftObjectPaths from a Class/Struct

Public function Virtual

bool

 

FindMissingChunkList

(
    const TArray < FSoftObjectPath >& A...,
    TArray < int32 >& OutMissingChunkLi...,
    TArray < int32 >& OutErrorChunkList
)

Returns the list of Chunks that are not currently mounted, and are required to load the referenced assets.

Public function Virtual

void

 

FinishInitialLoading()

Finishes initial loading, gets called from end of Engine::Init()

Public function Static

UAssetManage ...

 

Get()

Returns the current AssetManager object

Public function Virtual

bool

 

GetAssetBundleEntries

(
    const FPrimaryAssetId & BundleScope,
    TArray < FAssetBundleEntry >& OutEn...
)

Appends all AssetBundleInfos inside a given scope

Public function Virtual

FAssetBundle ...

 

GetAssetBundleEntry

(
    const FPrimaryAssetId & BundleScope,
    FName BundleName
)

Returns a single AssetBundleInfo, matching Scope and Name

Public function Virtual

bool

 

GetAssetDataForPath

(
    const FSoftObjectPath & ObjectPath,
    FAssetData & AssetData
)

Gets the FAssetData at a specific path, handles redirectors and blueprint classes correctly.

Protected function Virtual

void

 

GetAssetDataForPathInternal

(
    IAssetRegistry & AssetRegistry,
    const FString & AssetPath,
    OUT FAssetData & OutAssetData
)

Internal helper function that attempts to get asset data from the specified path; Accounts for possibility of blueprint classes ending in _C

Public function Virtual

FSoftObjectP ...

 

GetAssetPathForData

(
    const FAssetData & AssetData
)

Turns an FAssetData into FSoftObjectPath , handles adding _C as necessary

Public function

IAssetRegist ...

 

GetAssetRegistry()

Accessor for asset registry

Public function Static

UAssetManage ...

 

GetIfValid()

Returns the current AssetManager object if it exists, null otherwise

Public function Virtual

bool

 

GetManagedPackageList

(
    FPrimaryAssetId PrimaryAssetId,
    TArray < FName >& AssetPackageList
)

Returns list of asset packages managed by primary asset

Protected function

const FPrima...

 

GetNameData

(
    const FPrimaryAssetId & PrimaryAsse...,
    bool bCheckRedirector
)

Protected function

FPrimaryAsse...

 

GetNameData

(
    const FPrimaryAssetId & PrimaryAsse...,
    bool bCheckRedirector
)

Returns the NameData for a specific type/name pair

Public function Virtual

bool

 

GetPackageChunkIds

(
    FName PackageName,
    const ITargetPlatform * TargetP...,
    const TArray < int32 >& ExistingChu...,
    TArray < int32 >& OutChunkList
)

For a given package and platform, return what Chunks it should be assigned to, games can override this as needed.

Public function Virtual

EPrimaryAsse ...

 

GetPackageCookRule

(
    FName PackageName
)

Returns cook rule for a package name using Management rules, games should override this to take into account their individual workflows

Public function Virtual

bool

 

GetPackageManagers

(
    FName PackageName,
    bool bRecurseToParents,
    TSet < FPrimaryAssetId >& ManagerSe...
)

Returns list of PrimaryAssetIds that manage a package.

Public function Virtual

void

 

GetPreviousPrimaryAssetIds

(
    const FPrimaryAssetId & NewId,
    TArray < FPrimaryAssetId >& OutOldI...
)

Reads redirector list and gets a list of the redirected previous names for a Primary Asset Id

Public function

void

 

GetPrimaryAssetBundleStateMap

(
    TMap < FPrimaryAssetId , TArray < FNam ...,
    bool bForceCurrent
)

Fills in a TMap with the pending/active loading state of every asset

Public function Virtual

bool

 

GetPrimaryAssetData

(
    const FPrimaryAssetId & PrimaryAsse...,
    FAssetData & AssetData
)

ACCESSING ASSET DIRECTORY.

Public function Virtual

bool

 

GetPrimaryAssetDataList

(
    FPrimaryAssetType PrimaryAssetType,
    TArray < FAssetData >& AssetDataLis...
)

Gets list of all FAssetData for a primary asset type, returns true if any were found

Public function

TSharedPtr < ...

 

GetPrimaryAssetHandle

(
    const FPrimaryAssetId & PrimaryAsse...,
    bool bForceCurrent,
    TArray < FName >* Bundles
)

Returns the loading handle associated with the primary asset, it can then be checked for progress or waited on

Public function Virtual

FPrimaryAsse ...

 

GetPrimaryAssetIdForData

(
    const FAssetData & AssetData
)

Returns the primary asset Id for the given FAssetData , only works if in directory

Public function Virtual

FPrimaryAsse ...

 

GetPrimaryAssetIdForObject

(
    UObject * Object
)

Sees if the passed in object is a registered primary asset, if so return it.

Public function Virtual

FPrimaryAsse ...

 

GetPrimaryAssetIdForPackage

(
    FName PackagePath
)

Sees if the package has a primary asset, useful if only the package name is available

Public function Virtual

FPrimaryAsse ...

 

GetPrimaryAssetIdForPath

(
    const FSoftObjectPath & ObjectPath
)

Sees if the passed in object path is a registered primary asset, if so return it.

Public function Virtual

FPrimaryAsse ...

 

GetPrimaryAssetIdForPath

(
    FName ObjectPath
)

Public function Virtual

bool

 

GetPrimaryAssetIdList

(
    FPrimaryAssetType PrimaryAssetType,
    TArray < FPrimaryAssetId >& Primary...
)

Gets list of all FPrimaryAssetId for a primary asset type, returns true if any were found

Public function Virtual

UObject *...

 

GetPrimaryAssetObject

(
    const FPrimaryAssetId & PrimaryAsse...
)

Gets the in-memory UObject for a primary asset id, returning nullptr if it's not in memory.

Public function

AssetType &#...

 

GetPrimaryAssetObject

(
    const FPrimaryAssetId & PrimaryAsse...
)

Templated versions of above

Public function

TSubclassOf <...

 

GetPrimaryAssetObjectClass

(
    const FPrimaryAssetId & PrimaryAsse...
)

Public function Virtual

bool

 

GetPrimaryAssetObjectList

(
    FPrimaryAssetType PrimaryAssetType,
    TArray < UObject * >& ObjectLis...
)

Gets list of all loaded objects for a primary asset type, returns true if any were found.

Public function Virtual

FSoftObjectP ...

 

GetPrimaryAssetPath

(
    const FPrimaryAssetId & PrimaryAsse...
)

Gets the FSoftObjectPath for a primary asset type and name, returns invalid if not found

Public function Virtual

bool

 

GetPrimaryAssetPathList

(
    FPrimaryAssetType PrimaryAssetType,
    TArray < FSoftObjectPath >& AssetPa...
)

Gets the list of all FSoftObjectPaths for a given type, returns true if any found

Public function Virtual

FPrimaryAsse ...

 

GetPrimaryAssetRules

(
    FPrimaryAssetId PrimaryAssetId
)

Gets the management rules for a specific asset, this will merge the type and individual values

Public function

bool

 

GetPrimaryAssetsWithBundleState

(
    TArray < FPrimaryAssetId >& Primary...,
    const TArray < FPrimaryAssetType >&...,
    const TArray < FName >& RequiredBun...,
    const TArray < FName >& ExcludedBun...,
    bool bForceCurrent
)

Returns a list of primary assets that are in the given bundle state.

Public function Virtual

bool

 

GetPrimaryAssetTypeInfo

(
    FPrimaryAssetType PrimaryAssetType,
    FPrimaryAssetTypeInfo & AssetTypeIn...
)

Gets metadata for a specific asset type, returns false if not found

Public function Virtual

void

 

GetPrimaryAssetTypeInfoList

(
    TArray < FPrimaryAssetTypeInfo >& A...
)

Gets list of all primary asset types infos

Public function Virtual

FSoftObjectP ...

 

GetRedirectedAssetPath

(
    const FSoftObjectPath & OldPath
)

Public function Virtual

FName

 

GetRedirectedAssetPath

(
    FName OldPath
)

Reads AssetManagerSettings for specifically redirected asset paths.

Public function Virtual

FPrimaryAsse ...

 

GetRedirectedPrimaryAssetId

(
    const FPrimaryAssetId & OldId
)

Tries to redirect a Primary Asset Id, using list in AssetManagerSettings

Public function Virtual

bool

 

GetResourceAcquireProgress

(
    int32 & OutAcquiredCount,
    int32 & OutRequestedCount
)

Returns the chunk download/install progress.

Public function

const UAsset ...

 

GetSettings()

Return settings object

Public function Static

FStreamableM ...

 

GetStreamableManager()

Accesses the StreamableManager used by this Asset Manager. Static for easy access

Public function Virtual

void

 

InitializeAssetBundlesFromMetadata

(
    const UStruct * Struct,
    const void* StructValue,
    FAssetBundleData & AssetBundle
)

Initializes asset bundle data from a passed in struct or class, this will read the AssetBundles metadata off the UProperties.

Public function Virtual

void

 

InitializeAssetBundlesFromMetadata

(
    const UObject * Object,
    FAssetBundleData & AssetBundle
)

UObject wrapper

Protected function Virtual

bool

 

IsPathExcludedFromScan

(
    const FString & Path
)

Returns true if path should be excluded from primary asset scans

Public function Static

bool

 

IsValid()

Returns true if there is a current asset manager

Public function Virtual

TSharedPtr < ...

 

LoadAssetList

(
    const TArray < FSoftObjectPath >& A...,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority,
    const FString & DebugName
)

Quick wrapper to async load some non primary assets with the primary streamable manager.

Public function Virtual

TSharedPtr < ...

 

LoadPrimaryAsset

(
    const FPrimaryAssetId & AssetToLoad,
    const TArray < FName >& LoadBundles,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority
)

Single asset wrapper

Public function Virtual

TSharedPtr < ...

 

LoadPrimaryAssets

(
    const TArray < FPrimaryAssetId >& A...,
    const TArray < FName >& LoadBundles,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority
)

ASYNC LOADING PRIMARY ASSETS.

Public function Virtual

TSharedPtr < ...

 

LoadPrimaryAssetsWithType

(
    FPrimaryAssetType PrimaryAssetType,
    const TArray < FName >& LoadBundles,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority
)

Loads all assets of a given type, useful for cooking

Protected function Virtual

void

 

LoadRedirectorMaps()

Loads the redirector maps

Public function Virtual

void

 

ModifyCook

(
    TArray < FName >& PackagesToCook,
    TArray < FName >& PackagesToNeverCo...
)

EDITOR ONLY FUNCTIONALITY.

Protected function Virtual

void

 

OnAssetRegistryFilesLoaded()

Called when asset registry is done loading off disk, will finish any deferred loads

Protected function Virtual

void

 

OnAssetRenamed

(
    const FAssetData & NewData,
    const FString & OldPath
)

When asset is renamed

Protected function Virtual

void

 

OnAssetStateChangeCompleted

(
    FPrimaryAssetId PrimaryAssetId,
    TSharedPtr < FStreamableHandle > Bou...,
    FStreamableDelegate WrappedDelegate
)

Called when an internal load handle finishes, handles setting to pending state

Protected function Virtual

void

 

OnChunkDownloaded

(
    uint32 ChunkId,
    bool bSuccess
)

Called when a new chunk has been downloaded

Protected function Virtual

void

 

OnInMemoryAssetCreated

(
    UObject * Object
)

Handles updating manager when a new asset is created

Protected function Virtual

void

 

OnInMemoryAssetDeleted

(
    UObject * Object
)

Handles updating manager if deleted object is relevant

Protected function Virtual

void

 

PostInitialAssetScan()

Called after scanning is complete, either from FinishInitialLoading or after the AssetRegistry finishes

Protected function Virtual

void

 

PreBeginPIE

(
    bool bStartSimulate
)

Called right before PIE starts, will refresh asset directory and can be overriden to preload assets

Public function Virtual

TSharedPtr < ...

 

PreloadPrimaryAssets

(
    const TArray < FPrimaryAssetId >& A...,
    const TArray < FName >& LoadBundles,
    bool bLoadRecursive,
    FStreamableDelegate DelegateToCall,
    TAsyncLoadPriority Priority
)

Preloads data for a set of assets in a specific bundle state, and returns a handle you must keep active.

Protected function Virtual

void

 

RebuildObjectReferenceList()

Rebuilds the ObjectReferenceList, needed after global object state has changed

Public function Virtual

void

 

RecursivelyExpandBundleData

(
    FAssetBundleData & BundleData
)

This will expand out references in the passed in AssetBundleData that are pointing to other primary assets with bundles.

Public function Virtual

void

 

RefreshAssetData

(
    UObject * ChangedObject
)

Refreshes cache of asset data for in memory object

Public function Virtual

void

 

RefreshPrimaryAssetDirectory()

Refresh the entire set of asset data, can call from editor when things have changed dramatically

Public function Virtual

void

 

ReinitializeFromConfig()

Resets all asset manager data, called in the editor to reinitialize the config

Protected function Virtual

void

 

RemovePrimaryAssetId

(
    const FPrimaryAssetId & PrimaryAsse...
)

Try to remove an old asset identifier when it has been deleted/renamed

Public function Virtual

int32

 

ScanPathForPrimaryAssets

(
    FPrimaryAssetType PrimaryAssetType,
    const FString & Path,
    UClass * BaseClass,
    bool bHasBlueprintClasses,
    bool bIsEditorOnly,
    bool bForceSynchronousScan
)

Single path wrapper

Public function Virtual

int32

 

ScanPathsForPrimaryAssets

(
    FPrimaryAssetType PrimaryAssetType,
    const TArray < FString >& Paths,
    UClass * BaseClass,
    bool bHasBlueprintClasses,
    bool bIsEditorOnly,
    bool bForceSynchronousScan
)

BUILDING ASSET DIRECTORY.

Protected function Virtual

void

 

ScanPathsSynchronous

(
    const TArray < FString >& PathsToSc...
)

Helper function which requests the asset register scan a list of directories/assets

Protected function Virtual

void

 

ScanPrimaryAssetTypesFromConfig()

Scans all asset types specified in DefaultGame

Public function Virtual

void

 

SetPrimaryAssetRules

(
    FPrimaryAssetId PrimaryAssetId,
    const FPrimaryAssetRules & Rules
)

Changes the management rules for a specific asset, this overrides the type rules.

Public function Virtual

void

 

SetPrimaryAssetTypeRules

(
    FPrimaryAssetType PrimaryAssetType,
    const FPrimaryAssetRules & Rules
)

FUNCTIONS FOR MANAGEMENT/COOK RULES.

Protected function Virtual

bool

 

ShouldScanPrimaryAssetType

(
    FPrimaryAssetTypeInfo & TypeInfo
)

Returns true if the specified TypeInfo should be scanned. Can be implemented by the game.

Protected function Virtual

EAssetSetMan ...

 

ShouldSetManager

(
    const FAssetIdentifier & Manager,
    const FAssetIdentifier & Source,
    const FAssetIdentifier & Target,
    EAssetRegistryDependencyType::Type ...,
    EAssetSetManagerFlags::Type Flags
)

Function used during creating Management references to decide when to recurse and set references

Public function Virtual

void

 

StartBulkScanning()

Call this before many calls to ScanPaths to improve load performance.

Public function Virtual

void

 

StartInitialLoading()

Starts initial load, gets called from InitializeObjectReferences

Public function Virtual

void

 

StopBulkScanning()

Public function Virtual

int32

 

UnloadPrimaryAsset

(
    const FPrimaryAssetId & AssetToUnlo...
)

Single asset wrapper

Public function Virtual

int32

 

UnloadPrimaryAssets

(
    const TArray < FPrimaryAssetId >& A...
)

Unloads a list of Primary Assets that were previously Loaded.

Public function Virtual

int32

 

UnloadPrimaryAssetsWithType

(
    FPrimaryAssetType PrimaryAssetType
)

Loads all assets of a given type, useful for cooking

Protected function Virtual

void

 

UpdateCachedAssetData

(
    const FPrimaryAssetId & PrimaryAsse...,
    const FAssetData & NewAssetData,
    bool bAllowDuplicates
)

Updates the asset data cached on the name data

Public function Virtual

void

 

UpdateManagementDatabase

(
    bool bForceRefresh
)

Updates the asset management database if needed

Public function Virtual

bool

 

VerifyCanCookPackage

(
    FName PackageName,
    bool bLogError
)

Returns true if the specified asset package can be cooked, will error and return false if it is disallowed

Protected function Virtual

bool

 

WriteCustomReport

(
    FString FileName,
    TArray < FString >& FileLines
)

Helper function to write out asset reports

Overridden from UObject

Name Description

Public function Virtual

void

 

PostInitProperties()

Overrides.

Classes

Name

Description

Protected struct

FPendingChunkInstall

Defines a set of chunk installs that are waiting

Constants

Name

Description

MapType

Asset Type of UWorld assets

PrimaryAssetLabelType

Asset Type of Label used to tag other assets

References

Module

Engine

Header

Runtime/Engine/Classes/Engine/AssetManager.h