UKismetTextLibrary::Format
#include "Kismet/KismetTextLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Substitutes named arguments into a text pattern, culturally formatting each argument according to its type. Backs the Blueprint 'Format Text' node.
Caveats & Gotchas
- • Marked BlueprintInternalUseOnly — this is the function the Format Text K2 node compiles down to; calling it directly from C++ is possible but you should generally use FText::Format instead, which has a friendlier argument-building API.
- • Unmatched placeholders in InPattern that have no corresponding FFormatArgumentData entry are left as literal '{Name}' text rather than raising an error.
- • FFormatArgumentData carries separate fields for int/float/double/text/gender argument values — only the field matching ArgumentValueType is read, so setting the wrong one silently produces no output for that argument.
Signature
static FText Format(FText InPattern, TArray<FFormatArgumentData> InArgs); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InPattern | FText | The pattern text containing named placeholders, e.g. "{PlayerName} scored {Score} points". | — |
| InArgs | TArray<FFormatArgumentData> | Named argument/value pairs substituted into the pattern's placeholders. | — |
Return Type
FText Example
Build a score message from C++ (via FText::Format) C++
FFormatNamedArguments Args;
Args.Add(TEXT("PlayerName"), FText::FromString(TEXT("Ari")));
Args.Add(TEXT("Score"), FText::AsNumber(4200));
FText Message = FText::Format(FText::FromString(TEXT("{PlayerName} scored {Score} points")), Args); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?