RealDocs

FSoftObjectPath::ToString

function CoreUObject Blueprint Since 4.18
#include "UObject/SoftObjectPath.h"
Access: public Specifiers: const

Description

Returns the full path as an FString in the form `/Package/Path.AssetName` or `/Package/Path.AssetName:SubObjectPath` when a sub-object path is present.

Caveats & Gotchas

  • Allocates a new FString on every call. In tight loops or log-heavy code, prefer the AppendString overload that writes into an existing FStringBuilderBase to avoid repeated heap allocations.
  • A null FSoftObjectPath (IsNull() == true) returns an empty FString, not the string 'None'. Test IsNull() explicitly if you need to distinguish a null path from a valid path.

Signature

[[nodiscard]] COREUOBJECT_API FString ToString() const;

Return Type

FString

Example

Log a soft reference path C++
UPROPERTY(EditAnywhere)
FSoftObjectPath MyAssetRef;

void AMyActor::BeginPlay()
{
    Super::BeginPlay();
    UE_LOG(LogTemp, Log, TEXT("Asset path: %s"), *MyAssetRef.ToString());
}

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.