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

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.

Hi,

Thank you for the information, we have updated the ticket. If you find any new information or wish to report a bug in the future, we have switched to a new, better structured, bug reporting method:

https://epicsupport.force.com/unrealengine/s/

Thanks again!