RealDocs

TSoftObjectPtr

struct CoreUObject Since 4.18
#include "UObject/SoftObjectPtr.h"

Description

A typed soft reference to a UObject asset that stores the asset path as a string. The asset is not kept in memory — it must be loaded on demand. Replaces the older TAssetPtr.

Signature

template<class T=UObject> struct TSoftObjectPtr

Caveats & Gotchas

  • A valid TSoftObjectPtr does not mean the asset is loaded. Call LoadSynchronous() or use FStreamableManager::RequestAsyncLoad for async loading.
  • Can be serialized and saved — the path string persists across sessions.
  • Becomes invalid if the referenced asset is deleted or renamed in the editor.

Example

Async load a mesh asset C++
UPROPERTY(EditDefaultsOnly)
TSoftObjectPtr<UStaticMesh> MeshRef;

// Synchronous load (blocks until complete):
UStaticMesh* Mesh = MeshRef.LoadSynchronous();

// Or check if already loaded:
if (MeshRef.IsValid())
{
    UStaticMesh* Mesh = MeshRef.Get();
}

Version History

Introduced in: 4.18

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.