RealDocs

TSoftObjectPtr::LoadAsync

function CoreUObject Since 4.17
#include "UObject/SoftObjectPtr.h"
Access: public Specifiers: const

Description

Starts an asynchronous load of the referenced asset and returns a request ID. The completion delegate fires on the game thread once the asset is available; the caller must cast the resolved object to T inside the callback.

Caveats & Gotchas

  • The delegate receives an FSoftObjectPath, not a T* — you must call ResolveObject() and Cast<T> yourself, because the typed wrapper does not inject a type cast into the callback.
  • If LoadAsync is called on an already-loaded asset, the delegate may fire synchronously (before LoadAsync returns) in some engine configurations — design your callback to be re-entrant-safe.

Signature

int32 LoadAsync(FLoadSoftObjectPathAsyncDelegate InCompletionDelegate, FLoadAssetAsyncOptionalParams InOptionalParams = FLoadAssetAsyncOptionalParams()) const

Parameters

Name Type Description Default
InCompletionDelegate FLoadSoftObjectPathAsyncDelegate Delegate invoked on the game thread when the load completes. Receives the FSoftObjectPath; cast to T* inside the callback.
InOptionalParams FLoadAssetAsyncOptionalParams Optional parameters controlling load priority and other async load settings. FLoadAssetAsyncOptionalParams()

Return Type

int32

Example

Non-blocking asset load C++
UPROPERTY(EditDefaultsOnly)
TSoftObjectPtr<UTexture2D> LazyTexture;

void UMyWidget::RequestTexture()
{
    LazyTexture.LoadAsync(
        FLoadSoftObjectPathAsyncDelegate::CreateWeakLambda(this,
            [this](const FSoftObjectPath& Path)
            {
                if (UTexture2D* Tex = Cast<UTexture2D>(Path.ResolveObject()))
                {
                    SetBrushFromTexture(Tex);
                }
            })
    );
}

Version History

Introduced in: 4.17

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.