UKismetSystemLibrary::PrintString
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallableCallableWithoutWorldContextDevelopmentOnly
Description
Prints a debug string to the screen and/or the Output Log. This is the classic 'Print String' node most Blueprint tutorials start with, and the fastest way to sanity-check game state without attaching a debugger.
Caveats & Gotchas
- • Marked DevelopmentOnly — every call compiles out entirely in Shipping and Test builds, so it's unsuitable for anything that must run in a shipped build.
- • Repeated calls with the same non-empty Key replace the previous on-screen line rather than stacking new ones, which is useful for per-frame debug values but easy to forget when debugging multiple distinct messages.
Signature
static void PrintString(const UObject* WorldContextObject, const FString& InString = FString(TEXT("Hello")), bool bPrintToScreen = true, bool bPrintToLog = true, FLinearColor TextColor = FLinearColor(0.0f, 0.66f, 1.0f), float Duration = 2.f, const FName Key = NAME_None) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to resolve the World the message is printed in. | — |
| InString | const FString& | The text to print. | FString(TEXT("Hello")) |
| bPrintToScreen | bool | Whether to show an on-screen debug message. | true |
| bPrintToLog | bool | Whether to also write the message to the Output Log. | true |
| TextColor | FLinearColor | Color of the on-screen text. | FLinearColor(0.0f, 0.66f, 1.0f) |
| Duration | float | How long the on-screen message stays visible, in seconds. A negative value falls back to the duration configured in Engine.ini. | 2.f |
| Key | const FName | If non-empty, a later call with the same key replaces the previous on-screen message instead of adding a new line. | NAME_None |
Return Type
void Example
Basic debug print C++
UKismetSystemLibrary::PrintString(this, TEXT("Health changed"), true, true, FLinearColor::Red, 5.0f); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?