When an EditorUtilityWidget uses DrawDebugLine node every tick to draw a 0 duration line (which I believe is a legitimate use), FPS start dropping in PIE quite rapidly. The issue is that in ULineBatchComponent::DrawLine, these lines are added to an array, however they are only removed from the array in ULineBatchComponent::TickComponent. This usually gets called from FWidgetBlueprintEditor::Tick, but there is an explicit check for GEditor->PlayWorld - so when PIE is running, ULineBatchComponent doesn’t get ticks.
This means that the BatchedLines list doesn’t ever get pruned, amounting to hundreds of thousands of entries within minutes. Some rendering step is then called (even though it is never rendered), which then takes progressively longer to complete (in my example, it went to 40ms within two minutes of PIE).
It is possible to circument this by just for existence of PIE worlds before calling DebugDrawLines, however this duplicates the logic in FWidgetBlueprintEditor::Tick (which is already a bit more complicated than “Is PIE running”). I feel this should be fixed, so that either the BatchedLines gets pruned, or all Draw* methods on ULineBatchComponent do nothing in a setting where TickComponent wouldn’t get called.
Or maybe I am wrong, and these functions just can’t be called in EditorUtilityWidget? In that case, is there some other function that could be safely used here?