RealDocs

UKismetSystemLibrary::DrawDebugString

function Engine Blueprint Since 4.0
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Draws floating debug text at a world-space location, optionally attached to and moving with an actor.

Caveats & Gotchas

  • When TestBaseActor is set, TextLocation is interpreted as a relative offset from that actor rather than an absolute world position — passing an absolute location by mistake places the text far from the actor.
  • Compiled out entirely in Shipping and Test builds since the UFUNCTION is DevelopmentOnly.
  • Text always faces the viewport camera (billboarded) and ignores DepthPriority/Thickness parameters that other DrawDebug functions expose.

Signature

static void DrawDebugString(const UObject* WorldContextObject, const FVector TextLocation, const FString& Text, class AActor* TestBaseActor = NULL, FLinearColor TextColor = FLinearColor::White, float Duration=0.f)

Parameters

Name Type Description Default
WorldContextObject const UObject* World context used to resolve which world to draw in.
TextLocation const FVector World-space location for the text, or an offset from TestBaseActor if one is given.
Text const FString& Text to draw.
TestBaseActor AActor* If set, TextLocation is treated as an offset relative to this actor and the text moves with it. NULL
TextColor FLinearColor Color of the drawn text. FLinearColor::White
Duration float How long the text persists, in seconds. 0 draws for a single frame. 0.f

Return Type

void

Example

Label an actor with floating text C++
UKismetSystemLibrary::DrawDebugString(
    this,
    FVector(0.f, 0.f, 100.f),
    FString::Printf(TEXT("HP: %d"), CurrentHealth),
    this,
    FLinearColor::Red,
    0.f);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.