UAssetManager::GetPrimaryAssetObjectClass
#include "Engine/AssetManager.h"
Access: public
Specifiers: inlineconst
Description
Templated helper that gets the in-memory class object for a primary asset id, useful when the primary asset is itself a Blueprint class.
Caveats & Gotchas
- • Returns an empty TSubclassOf if the asset isn't loaded or isn't a UClass — it silently casts rather than asserting.
- • Internally calls GetPrimaryAssetObject and Cast<UClass>, so it has the same in-memory-only limitation: it never triggers a load.
Signature
template<class AssetType>
inline TSubclassOf<AssetType> GetPrimaryAssetObjectClass(const FPrimaryAssetId& PrimaryAssetId) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PrimaryAssetId | const FPrimaryAssetId& | Type/name of the primary asset to look up. | — |
Return Type
TSubclassOf<AssetType> Example
Get a Blueprint class for spawning C++
TSubclassOf<AActor> ItemClass = UAssetManager::Get().GetPrimaryAssetObjectClass<AActor>(
FPrimaryAssetId(TEXT("Item"), TEXT("Sword")));
if (ItemClass)
{
GetWorld()->SpawnActor<AActor>(ItemClass);
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?