Draw debug string appears to render in the wrong location UE-54346

kurtrussellfanclub
Thu, 19 Dec 2019 22:18:29 +0000
Debugging, Optimization, & Profiling

This bug has already been logged but I’m adding more details Unreal Engine Issues and Bug Tracker (UE-54346)

To reproduce:
The bug appears when you turn on DPI scaling in Windows. Start Menu → Change Size of Text, Apps and Other Items → Increase from 100% to 150 or 200%.

Then draw debug string in 3d viewport -

By using the Draw Debug String blueprint node

By making a vector or transform variable in a blueprint and toggling on “Show 3D Widget” checkbox for that variable

Debug text in the viewport will appear offset.

The issue appears to be in Engine\Source\Runtime\Engine\Private\UserInterface\CanvasItem.cpp

The method FCanvasTextItemBase::Draw multiplies positions by DPI, then passes result eventually into DrawStringInternal_RuntimeCache which does the DPI multiply a second time! I can’t do a fix, though, because I am not sure which of two should be removed. Under some cases ::Draw will call an offline cache method instead of the runtime cache one and I am not familiar enough with when that’s called to know where the DPI code should go.

2 posts - 1 participant