AAIController::DisplayDebug
#include "AIController.h"
Access: public
Specifiers: virtualoverrideAIMODULE_API
Description
Draws AI-specific debug information (behavior tree state, path, focus, perception) onto the HUD canvas when the 'AI' debug category is active via the `showdebug AI` console command.
Caveats & Gotchas
- • Only meaningful in non-shipping builds. This function is not compiled or called in shipping builds.
- • When overriding, call Super::DisplayDebug() first and advance YPos by YL after each line you draw to avoid text overlap with the base class output.
Signature
virtual void DisplayDebug(UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Canvas | UCanvas* | The canvas to draw debug information onto. | — |
| DebugDisplay | const FDebugDisplayInfo& | Describes which debug categories are currently active. | — |
| YL | float& | In/out: height of the last drawn line, used to advance YPos. | — |
| YPos | float& | In/out: current vertical draw position on the canvas. | — |
Return Type
void Example
Add a custom debug line in a subclass C++
void AMyAIController::DisplayDebug(UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos)
{
Super::DisplayDebug(Canvas, DebugDisplay, YL, YPos);
FString Info = FString::Printf(TEXT("State: %s"), *CurrentStateName.ToString());
Canvas->DrawText(GEngine->GetSmallFont(), Info, 4.f, YPos);
YPos += YL;
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?