UAssetManager::GetPrimaryAssetData
#include "Engine/AssetManager.h"
Access: public
Specifiers: virtualconst
Description
Gets the FAssetData for a primary asset with the specified type/name. Only works for assets that have already been scanned.
Caveats & Gotchas
- • Returns false and leaves AssetData untouched if the type hasn't been scanned yet or the name isn't registered — this is not an error condition, just check the return value.
- • Does not load the asset; it only returns registry metadata, so the asset may still be unloaded after this call.
Signature
virtual bool GetPrimaryAssetData(const FPrimaryAssetId& PrimaryAssetId, FAssetData& AssetData) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PrimaryAssetId | const FPrimaryAssetId& | Type/name of the primary asset to look up. | — |
| AssetData | FAssetData& | Out parameter filled with the asset registry data if found. | — |
Return Type
bool Example
Look up asset metadata C++
FAssetData AssetData;
if (UAssetManager::Get().GetPrimaryAssetData(FPrimaryAssetId(TEXT("Item"), TEXT("Sword")), AssetData))
{
UE_LOG(LogTemp, Log, TEXT("Found asset: %s"), *AssetData.PackageName.ToString());
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?