UAssetManager::GetPrimaryAssetObject
#include "Engine/AssetManager.h"
Access: public
Specifiers: virtualconst
Description
Gets the in-memory UObject for a primary asset id, returning nullptr if it isn't currently loaded. Works even if the asset wasn't explicitly loaded through the asset manager.
Caveats & Gotchas
- • Returns the Blueprint generated class object for Blueprint assets rather than a CDO or instance — check the returned type accordingly.
- • A templated overload, GetPrimaryAssetObject<AssetType>, casts the result for you and is usually more convenient than calling this raw UObject* version directly.
Signature
virtual UObject* GetPrimaryAssetObject(const FPrimaryAssetId& PrimaryAssetId) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PrimaryAssetId | const FPrimaryAssetId& | Type/name of the primary asset to look up. | — |
Return Type
UObject* Example
Fetch a loaded asset C++
if (UObject* Obj = UAssetManager::Get().GetPrimaryAssetObject(FPrimaryAssetId(TEXT("Item"), TEXT("Sword"))))
{
// Asset is already in memory
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?