UAssetManager::GetPrimaryAssetPath
#include "Engine/AssetManager.h"
Access: public
Specifiers: virtualconst
Description
Gets the FSoftObjectPath for a primary asset type and name, returning an invalid path if the asset isn't found.
Caveats & Gotchas
- • Always check IsValid() on the returned FSoftObjectPath — an invalid path is the only signal that the id wasn't found, there's no separate bool return.
- • This does not load the asset; it only resolves the registered path, so pass the result to LoadObject or the streamable manager to actually load it.
Signature
virtual FSoftObjectPath GetPrimaryAssetPath(const FPrimaryAssetId& PrimaryAssetId) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PrimaryAssetId | const FPrimaryAssetId& | Type/name of the primary asset to look up. | — |
Return Type
FSoftObjectPath Example
Resolve path before loading C++
FSoftObjectPath Path = UAssetManager::Get().GetPrimaryAssetPath(FPrimaryAssetId(TEXT("Item"), TEXT("Sword")));
if (Path.IsValid())
{
UObject* Loaded = Path.TryLoad();
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?