RealDocs

UAssetManager::Register_OnAddedAssetSearchRoot

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

Description

Registers a callback that fires whenever a new asset search root is mounted at runtime, such as from a plugin or pak file. Pair with Unregister_OnAddedAssetSearchRoot to remove it.

Caveats & Gotchas

  • The delegate only fires for roots added after registration, not for search roots that already existed (like /Game) — check GetAssetSearchRoots() for the current state at registration time.
  • Always call Unregister_OnAddedAssetSearchRoot with the returned FDelegateHandle when your object is destroyed, or the AssetManager can call into a dangling delegate.
  • The passed-in FString has no trailing slash, unlike some other path APIs in the engine — don't assume you need to strip one.

Signature

FDelegateHandle Register_OnAddedAssetSearchRoot(FOnAddedAssetSearchRoot::FDelegate&& Delegate);

Parameters

Name Type Description Default
Delegate FOnAddedAssetSearchRoot::FDelegate&& Callback invoked with the new root path (no trailing slash) whenever one is registered at runtime.

Return Type

FDelegateHandle

Example

Reacting to a newly mounted asset root C++
FDelegateHandle RootHandle = UAssetManager::Get().Register_OnAddedAssetSearchRoot(
	FOnAddedAssetSearchRoot::FDelegate::CreateUObject(this, &AMyClass::OnAssetRootAdded));
// Later, e.g. in EndPlay:
UAssetManager::Get().Unregister_OnAddedAssetSearchRoot(RootHandle);

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.