AAIController::GrabDebugSnapshot
#include "AIController.h"
Access: public
Specifiers: virtualoverrideAIMODULE_APIconst
Description
Populates a Visual Logger snapshot with the controller's current AI state (path, focus, perception), enabling replay and analysis in the Visual Logger editor tool.
Caveats & Gotchas
- • This function is only compiled when ENABLE_VISUAL_LOG is defined (editor/development builds). Wrap any direct calls in #if ENABLE_VISUAL_LOG to avoid compile errors in shipping.
- • Visual Logger snapshots are sampled every frame during recording. Avoid heavy string formatting or allocations inside this function when many AI agents are active simultaneously.
Signature
virtual void GrabDebugSnapshot(FVisualLogEntry* Snapshot) const override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Snapshot | FVisualLogEntry* | The Visual Logger entry to populate with the controller's current AI state. | — |
Return Type
void Example
Extend the snapshot with custom data C++
#if ENABLE_VISUAL_LOG
void AMyAIController::GrabDebugSnapshot(FVisualLogEntry* Snapshot) const
{
Super::GrabDebugSnapshot(Snapshot);
FVisualLogStatusCategory MyCategory(TEXT("MyAI"));
MyCategory.Add(TEXT("Threat"), ThreatTarget ? *ThreatTarget->GetName() : TEXT("None"));
Snapshot->Status.Add(MyCategory);
}
#endif See Also
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?