I found myself wanting a basic tool for quickly adding debug geometry to my scene at any time using a single call and then having it disappear automatically later after a delay. So I made a subsystem called VisualDebugger that wraps calls to DebugRenderer like DebugRenderer->AddLine(…) etc.
Specify camera for displaying labels in the world:
In HandlePostRenderUpdate() Issue the draw call to draw all geometry:
Example Usage anywhere:
VisualDebuggerUILabel* label = GetSubsystem<VisualDebugger>()->AddLabel(Vector3(0,0,0), “my debug label in the world”);
By default geometry will last 2 seconds until it is deleted.
This can be changed with a call to SetObjectLifeTimeMs() Or by calling label->SetLifeTimeMs() for individual control.
You can also restrict the max number of draw-able objects and/or the maximum time spent in the DrawDebugGeometry() call.