Description
Converts the FName to a human-readable FString including the numeric suffix if present. This is the standard way to display or log an FName.
Caveats & Gotchas
- • Allocates a new FString on the heap each call. In hot paths or tight loops prefer AppendString into a reusable builder, or use the non-allocating template overload ToString(TCHAR (&Out)[N]) with a stack buffer of at least FName::StringBufferSize.
- • A default-constructed FName (NAME_None) returns the string "None", not an empty string. Guard against this if you're using the result as an asset path or identifier.
- • The raw-pointer overload ToString(TCHAR* Out, uint32 OutSize) was deprecated in UE 5.6 due to buffer-overflow risk — use the templated or allocating overloads instead.
Signature
[[nodiscard]] CORE_API FString ToString() const Return Type
FString Example
Log the name of the current level C++
FName LevelName = GetWorld()->GetCurrentLevel()->GetFName();
UE_LOG(LogTemp, Log, TEXT("Current level: %s"), *LevelName.ToString()); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | Raw-pointer overload deprecated in 5.6; use templated ToString or allocating overload. |
Feedback
Was this helpful?