FSoftObjectPath
#include "UObject/SoftObjectPath.h" Description
A string-based reference to a UObject asset stored as a top-level asset path plus an optional sub-object path. Used as the underlying storage for TSoftObjectPtr and TSoftClassPtr.
Signature
struct FSoftObjectPath Caveats & Gotchas
- • The path format is `/PackageName/AssetName.AssetName` for top-level assets. Sub-objects use `/Package/Asset.Asset:SubObject`.
- • Validity of the path (IsValid()) only means the string is non-empty — it does not check if the asset exists on disk.
- • Use the Asset Registry to verify an asset exists before attempting a load.
Example
Construct and use an FSoftObjectPath C++
FSoftObjectPath Path(TEXT("/Game/Meshes/SM_Rock.SM_Rock"));
if (Path.IsValid())
{
UObject* Asset = Path.TryLoad(); // blocking load
UStaticMesh* Mesh = Cast<UStaticMesh>(Asset);
} See Also
Tags
Version History
Introduced in: 4.18
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?