FSoftObjectPath::SetSubPathString
#include "UObject/SoftObjectPath.h"
Access: public
Specifiers: inline
Description
Sets only the sub-object path portion of this FSoftObjectPath, leaving the top-level asset path (package and asset name) unchanged.
Caveats & Gotchas
- • As of UE 5.6 the FWideString overload is silently deprecated via UE_SOFTOBJECTPATH_FSTRING_DEPRECATED. Use FUtf8String or a UTF-8 string view to future-proof call sites against the deprecation macro being re-enabled.
- • Setting the sub-path to an empty string makes this path point to the top-level asset only (equivalent to GetWithoutSubPath()). IsSubobject() will return false afterwards.
Signature
UE_FORCEINLINE_HINT void SetSubPathString(TStringOverload<FUtf8String> InSubPathString) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InSubPathString | TStringOverload<FUtf8String> | The UTF-8 sub-object path string to set (e.g. 'Components.StaticMesh'). | — |
Return Type
void Example
Target a specific component inside a Blueprint asset C++
FSoftObjectPath AssetRef(TEXT("/Game/Blueprints/BP_Player.BP_Player_C"));
AssetRef.SetSubPathString(FUtf8String("MeshComponent"));
// AssetRef now points to /Game/Blueprints/BP_Player.BP_Player_C:MeshComponent Tags
Version History
Introduced in: 4.18
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?