RealDocs

UAssetManager::RegisterSpecificPrimaryAsset

function Engine Since 4.22
#include "Engine/AssetManager.h"
Access: public Specifiers: virtual

Description

Manually registers a new or updated Primary Asset outside of the normal directory-scan flow. Returns true if registration succeeded.

Caveats & Gotchas

  • Intended for assets that exist outside the configured Primary Asset scan directories (e.g. dynamically generated or runtime-created assets) — assets under normal scan paths get registered automatically and don't need this.
  • Not const, since it mutates the Asset Manager's internal Primary Asset registry — calling it from a const context requires going through a non-const accessor.
  • Does not itself check DoesAssetMatchSearchRules; the caller is responsible for ensuring the asset data and ID are consistent before registering.

Signature

virtual bool RegisterSpecificPrimaryAsset(const FPrimaryAssetId& PrimaryAssetId, const FAssetData& NewAssetData)

Parameters

Name Type Description Default
PrimaryAssetId const FPrimaryAssetId& ID to register or update the asset under.
NewAssetData const FAssetData& Asset registry data for the asset being registered.

Return Type

bool

Example

Register a runtime-generated asset C++
FPrimaryAssetId NewId(FPrimaryAssetType("GeneratedItem"), FName("RuntimeSword_01"));
bool bRegistered = UAssetManager::Get().RegisterSpecificPrimaryAsset(NewId, GeneratedAssetData);

Version History

Introduced in: 4.22

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.