class

TSoftObjectPtr

Soft asset reference — stores a stable path, lazy-loads the asset through FSoftAssetResolver on LoadSynchronous() and caches a strong Ref<T>. Use in components / properties that reference an asset that may not be loaded yet (or may be unloaded and reloaded on demand). T must derive from RefCounted (our assets are intrusive-refcounted, not MObjects — asset lifetime stays with the Ref system, NOT the GC).

Module
Core
Header
#include "Core/TObjectPtr.h"
Namespace
Mowo
Template
template<typename T>

Null returns mean: empty path, no resolver installed for T (asset module not initialised — headless tools), or the load failed.

Constructors

SignatureNameDescription
TSoftObjectPtr() = defaultTSoftObjectPtr
explicit TSoftObjectPtr(std::string assetPath) : m_path(std::move(assetPath))TSoftObjectPtr
explicit TSoftObjectPtr(FName assetId) : m_id(assetId)TSoftObjectPtr
explicit TSoftObjectPtr(const FSoftObjectPath& path) : m_path(path.AssetPath)TSoftObjectPtr

Public functions

ReturnsNameDescription
boolIsNull
T*ResolveCached strong reference if already resolved, nullptr otherwise.
T*LoadSynchronousSynchronous resolve — loads through the installed resolver on first call, caches the strong reference.
voidLoadAsyncAsync resolve.
voidPrimeStore an externally-loaded strong reference as this pointer's cache — the LoadAsync completion path when the holder survives.
FNameGetAssetId
const std::string&GetAssetPath
FSoftObjectPathToSoftObjectPathWhat a reflected property stores: hold an FSoftObjectPath field and build the pointer from it where the asset is loaded.
voidResetDrop the path AND the cached reference.
voidSetPathPoint at a new asset — clears the cache so the next LoadSynchronous() loads the new path.

Function details

TSoftObjectPtr

C++
TSoftObjectPtr() = default

TSoftObjectPtr

C++
explicit TSoftObjectPtr(std::string assetPath) : m_path(std::move(assetPath))

TSoftObjectPtr

C++
explicit TSoftObjectPtr(FName assetId) : m_id(assetId)

TSoftObjectPtr

C++
explicit TSoftObjectPtr(const FSoftObjectPath& path) : m_path(path.AssetPath)

IsNull

C++
bool IsNull() const noexcept

Resolve

C++
T* Resolve() const noexcept

Cached strong reference if already resolved, nullptr otherwise. Never triggers a load — pair with LoadSynchronous().

LoadSynchronous

C++
T* LoadSynchronous()

Synchronous resolve — loads through the installed resolver on first call, caches the strong reference.

LoadAsync

C++
void LoadAsync(std::function<void(Ref<T>)> onLoaded)

Async resolve. onLoaded receives the loaded Ref (null on failure) — on the main thread when the game-side async pipeline is installed, inline otherwise (already-cached, empty path, or sync-only resolver; same guarantees as LoadSynchronous in those cases). Deliberately does NOT write m_cached: the pointer may die before completion, so the callback owns the result — cache it back with Prime() if the holder is still alive.

Prime

C++
void Prime(Ref<T> loaded)

Store an externally-loaded strong reference as this pointer's cache — the LoadAsync completion path when the holder survives.

GetAssetId

C++
FName GetAssetId() const noexcept

GetAssetPath

C++
const std::string& GetAssetPath() const noexcept

ToSoftObjectPath

C++
FSoftObjectPath ToSoftObjectPath() const

What a reflected property stores: hold an FSoftObjectPath field and build the pointer from it where the asset is loaded.

Reset

C++
void Reset()

Drop the path AND the cached reference.

SetPath

C++
void SetPath(std::string path)

Point at a new asset — clears the cache so the next LoadSynchronous() loads the new path.

Generated from Core/TObjectPtr.h via core.json · Nov 5, 2026Version 1.0.0