RealDocs

UAssetManager::DeterminePrimaryAssetIdForObject

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

Description

Used when bShouldManagerDetermineTypeAndName is enabled in Asset Manager settings to compute a Primary Asset Id for objects that don't implement their own IPrimaryAssetObject-style logic. Games can override this to customize the fallback rule.

Caveats & Gotchas

  • Only called when the object doesn't already provide its own Primary Asset Id (e.g. via GetPrimaryAssetId), so overriding it has no effect on types that implement that themselves.
  • The default implementation derives the type from the asset's class and the name from the asset name — override this in a game-specific UAssetManager subclass if you need a different scheme.

Signature

virtual FPrimaryAssetId DeterminePrimaryAssetIdForObject(const UObject* Object) const

Parameters

Name Type Description Default
Object const UObject* Object to compute a Primary Asset Id for.

Return Type

FPrimaryAssetId

Example

Override in a game-specific Asset Manager C++
FPrimaryAssetId UMyAssetManager::DeterminePrimaryAssetIdForObject(const UObject* Object) const
{
	if (const UMyItemData* Item = Cast<UMyItemData>(Object))
	{
		return FPrimaryAssetId(FPrimaryAssetType("Item"), Item->GetFName());
	}
	return Super::DeterminePrimaryAssetIdForObject(Object);
}

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.