RealDocs

UKismetSystemLibrary::DrawDebugSphere

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

Description

Draws a wireframe debug sphere built from three orthogonal circles, commonly used to visualize a radius such as a sphere trace or overlap check.

Caveats & Gotchas

  • Compiled out entirely in Shipping and Test builds since the UFUNCTION is DevelopmentOnly.
  • High Segments values on many simultaneous spheres (e.g. one per Tick per actor) can visibly impact frame time in PIE/editor — keep Duration and Segments modest for per-frame debug draws.

Signature

static void DrawDebugSphere(const UObject* WorldContextObject, const FVector Center, float Radius=100.f, int32 Segments=12, FLinearColor LineColor = FLinearColor::White, 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.
Center const FVector World-space center of the sphere.
Radius float Radius of the sphere. 100.f
Segments int32 Number of segments used per great circle when approximating the sphere. 12
LineColor FLinearColor Color of the drawn sphere. FLinearColor::White
Duration float How long the sphere persists, in seconds. 0 draws for a single frame. 0.f
Thickness float Line thickness in screen pixels. 0.f
DepthPriority EDrawDebugSceneDepthPriorityGroup Whether the sphere is depth-tested against the scene or always drawn in the foreground. EDrawDebugSceneDepthPriorityGroup::World

Return Type

void

Example

Visualize an overlap radius C++
UKismetSystemLibrary::DrawDebugSphere(
    this,
    GetActorLocation(),
    OverlapRadius,
    16,
    FLinearColor::Yellow,
    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.