TSoftObjectPtr
#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.
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.
Signature
template<class T=UObject> struct TSoftObjectPtr 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();
} Functions (6)
Utility 6 ▼
| Access | Type | Name |
|---|---|---|
| public | function | TSoftObjectPtr::Reset |
| public | function | TSoftObjectPtr::LoadAsync |
| public | function | TSoftObjectPtr::LoadSynchronous |
| public | function | TSoftObjectPtr::ResetWeakPtr |
| public | function | TSoftObjectPtr::UE_SOFTOBJECTPTR_CONVERSION_DEPRECATED (deprecated conversion overloads) deprecated |
| public | function | TSoftObjectPtr::UE_REQUIRES (constrained conversion constructor) |
Properties
| Access | Type | Name |
|---|---|---|
| private | property | TSoftObjectPtr::SoftObjectPtr |
See Also
Version History
Introduced in: 4.18
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?