UKismetSystemLibrary::DrawDebugLine
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Draws a straight debug line between two world-space points for a set duration.
Caveats & Gotchas
- • Compiled out entirely in Shipping and Test builds — the UFUNCTION is DevelopmentOnly, so calls in those configurations silently do nothing.
- • A Duration of 0 draws the line for one frame only; call it every Tick if you need a persistent-looking line without using FlushPersistentDebugLines cleanup.
- • Negative Duration values make the line persistent until FlushPersistentDebugLines is called.
Signature
static void DrawDebugLine(const UObject* WorldContextObject, const FVector LineStart, const FVector LineEnd, FLinearColor LineColor, float Duration=0.f, float Thickness = 0.f, EDrawDebugSceneDepthPriorityGroup DepthPriority = EDrawDebugSceneDepthPriorityGroup::World) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | World context used to resolve which world to draw in. | — |
| LineStart | const FVector | World-space start point. | — |
| LineEnd | const FVector | World-space end point. | — |
| LineColor | FLinearColor | Color of the drawn line. | — |
| Duration | float | How long the line persists, in seconds. 0 draws for a single frame. | 0.f |
| Thickness | float | Line thickness in screen pixels. | 0.f |
| DepthPriority | EDrawDebugSceneDepthPriorityGroup | Whether the line is depth-tested against the scene or always drawn in the foreground. | EDrawDebugSceneDepthPriorityGroup::World |
Return Type
void Example
Draw a line for one second C++
UKismetSystemLibrary::DrawDebugLine(
this,
GetActorLocation(),
GetActorLocation() + GetActorForwardVector() * 200.f,
FLinearColor::Green,
1.0f,
2.0f); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?