UPrimaryDataAsset
#include "Engine/DataAsset.h" Description
A data asset subclass that implements GetPrimaryAssetId, allowing it to be registered with UAssetManager for on-demand async loading, bundle management, and chunked DLC.
Signature
class UPrimaryDataAsset : public UDataAsset Caveats & Gotchas
- • The PrimaryAssetType is derived from the first native class in the hierarchy — if you only have Blueprint subclasses of UPrimaryDataAsset, the type will be the Blueprint class name, which can change if renamed.
- • Instances must be registered in the Asset Manager settings to be discoverable. Add the class and asset paths under 'Primary Asset Types to Scan'.
- • AssetBundleData is computed at save time in editor and baked into the asset registry at cook time — runtime bundle queries read from that baked data, not live discovery.
Example
Define a manageable item data asset C++
UCLASS(Blueprintable)
class UItemData : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly)
FText DisplayName;
UPROPERTY(EditDefaultsOnly, meta=(AssetBundles="UI"))
TSoftObjectPtr<UTexture2D> Icon;
UPROPERTY(EditDefaultsOnly, meta=(AssetBundles="Game"))
TSoftObjectPtr<UStaticMesh> Mesh;
}; See Also
Tags
Version History
Introduced in: 4.17
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?