UAssetManager::ExtractPrimaryAssetIdFromData
#include "Engine/AssetManager.h"
Access: public
Specifiers: virtualconst
Description
Parses an FAssetData to derive the primary asset type and name from it, working even for assets that aren't in the primary asset directory (for example, ones excluded from scanning).
Caveats & Gotchas
- • Unlike GetPrimaryAssetIdForData, this doesn't require the asset to already be registered in the directory — it derives the ID directly from the asset's class and tags, so it can be used on arbitrary asset data during a scan.
- • The returned FPrimaryAssetId may not correspond to anything the asset manager is actually tracking; check IsValid() and, if needed, cross-reference against GetPrimaryAssetIdList before relying on it.
Signature
virtual FPrimaryAssetId ExtractPrimaryAssetIdFromData(const FAssetData& AssetData, FPrimaryAssetType SuggestedType = FPrimaryAssetType()) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| AssetData | const FAssetData& | Asset registry data to parse a primary asset ID from. | — |
| SuggestedType | FPrimaryAssetType | Type to use as a hint if the asset itself doesn't clearly imply one. | FPrimaryAssetType() |
Return Type
FPrimaryAssetId Example
Derive a primary asset ID during a custom scan C++
UAssetManager& Manager = UAssetManager::Get();
FAssetData Data = GetAssetDataSomehow();
FPrimaryAssetId AssetId = Manager.ExtractPrimaryAssetIdFromData(Data, FPrimaryAssetType(TEXT("Item")));
if (AssetId.IsValid())
{
UE_LOG(LogTemp, Log, TEXT("Derived asset id: %s"), *AssetId.ToString());
} Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?