RealDocs

UAssetManager::GetAssetDataForPath

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

Description

Gets the FAssetData at a specific path, correctly handling redirectors and Blueprint classes along the way. Returns true if valid data was found.

Caveats & Gotchas

  • Unlike a raw asset registry GetAssetByObjectPath call, this follows redirectors so moved/renamed assets still resolve correctly.
  • For Blueprint classes, pass the object path (which may include the _C suffix) rather than the package path, or the lookup can fail to find the generated class asset.
  • Runs synchronously against whatever data the asset registry currently has cached; if the target directory hasn't been scanned yet the lookup can fail even though the asset exists on disk.

Signature

virtual bool GetAssetDataForPath(const FSoftObjectPath& ObjectPath, FAssetData& AssetData) const

Parameters

Name Type Description Default
ObjectPath const FSoftObjectPath& Soft path to the asset to look up.
AssetData FAssetData& Out parameter filled with the asset registry data if found.

Return Type

bool

Example

Look up asset data by soft path C++
FSoftObjectPath ItemPath(TEXT("/Game/Items/BP_Sword.BP_Sword"));
FAssetData FoundData;
if (UAssetManager::Get().GetAssetDataForPath(ItemPath, FoundData))
{
	UE_LOG(LogTemp, Log, TEXT("Found asset: %s"), *FoundData.AssetName.ToString());
}

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.