ACharacter::DisplayDebug
#include "GameFramework/Character.h"
Access: public
Specifiers: virtualoverride
Description
Draws Character-specific debug information (movement state, jump state, based movement) to the HUD canvas when `showdebug` is active. Extends the APawn implementation with Character-specific sections.
Caveats & Gotchas
- • Enable the output with the console command `showdebug character` at runtime; the function is only called when the relevant debug category is active.
- • Do not call this from gameplay code — it is wired into the engine's debug HUD system and called automatically during the render frame.
Signature
ENGINE_API virtual void DisplayDebug(class UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Canvas | UCanvas* | Canvas to draw debug text and shapes onto. | — |
| DebugDisplay | const FDebugDisplayInfo& | Struct describing which debug categories are currently active. | — |
| YL | float& | Height of the last line drawn; used to advance YPos for subsequent lines. | — |
| YPos | float& | Current vertical draw position on the canvas; incremented as lines are drawn. | — |
Return Type
void Example
Add a custom debug line to the Character debug display C++
void AMyCharacter::DisplayDebug(UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos)
{
Super::DisplayDebug(Canvas, DebugDisplay, YL, YPos);
FString CustomLine = FString::Printf(TEXT("Stamina: %.1f"), Stamina);
Canvas->SetDrawColor(FColor::Cyan);
Canvas->DrawText(GEngine->GetMediumFont(), CustomLine, 4.f, YPos);
YPos += YL;
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?