RealDocs

UAssetManager::UnloadPrimaryAssets

function Engine Since unknown
#include "Engine/AssetManager.h"
Access: public Specifiers: virtual

Description

Unloads a list of primary assets that were previously loaded through the asset manager, releasing them if nothing else is keeping them in memory.

Caveats & Gotchas

  • Only releases the asset manager's own reference — if another system (e.g. a hard UPROPERTY reference) still holds a strong pointer, the object stays resident despite this call.
  • The returned count is how many assets had their load count decremented, not how many were actually garbage collected; GC still runs asynchronously afterward.

Signature

virtual int32 UnloadPrimaryAssets(const TArray<FPrimaryAssetId>& AssetsToUnload);

Parameters

Name Type Description Default
AssetsToUnload const TArray<FPrimaryAssetId>& List of primary assets that were previously loaded and should now be released.

Return Type

int32

Example

Release a batch of loaded items C++
TArray<FPrimaryAssetId> ToUnload = { FPrimaryAssetId(TEXT("Item"), TEXT("Sword")) };
int32 NumUnloaded = UAssetManager::Get().UnloadPrimaryAssets(ToUnload);

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.