AddOnScreenDebugMessage only works with key -1

If I pass -1 as the key to AddOnScreenDebugMessage, I get a scrolling log. If I pass 0 as the key, to have just one message, nothing is shown on screen.

1 Like

I just hit the same problem after converting a project from 4.18.3 to 4.19.0. It looks as though this is a bug in 4.19.

The DrawOnscreenDebugMessages function in UnrealEngine.cpp is applying a scale value of zero to the drawing of all non-priority messages. In the same function, priority messages (where key is -1) are not having this value set, so the default value in the FCanvasTextItem constructor of (1,1) remains.

I thought the TextScale parameter for AddOnScreenDebugMessage might help, but it would appear as though this is completely ignored.

Diffing the two files from 4.18 and 4.19 shows that the line MessageTextItem.Scale = Message.TextScale; was removed from the priority message code logic, but not from the non-priority path in the same function. I assume some other change necessitated the scaling modification but it wasn’t applied everywhere it was required.

1 Like

Our log system is not working anymore after upgrading to 4.19, thanks to this bug/change. I even posted a few times on the forum. It seems nobody knows the answer.

1 Like

Dude, I think 4.19.1 came out and this wasn’t fixed, anyone else can confirm this?

1 Like

Confirmed!

1 Like

Has anyone even reported the issue? I couldn’t find a bug report on their bug tracker for this issue. I’m using the source code from GitHub and rebuild the engine on a daily basis the bug is still there.

1 Like

Thank you for bringing this issue to my attention. I submitting a PR with the necessary code changes to make this work, see https://github.com/EpicGames/UnrealEngine/pull/4675 , which should hopefully be reviewed by Epic soon™.

1 Like

Thank you so much for the fix! Hope to see it in 4.19 soon.

1 Like

I think the earliest version it will be fixed in will be 4.20 unfortunately

1 Like

This is a trivial bug to fix. In AddOnScreenDebugMessage the last param is TextScale but it is never used. The fix is actually pretty simple, below “NewMessage.ScreenMessage = DebugMessage;” just insert this: “NewMessage.TextScale = TextScale;”

Messages with the “-1” key are added to the PriorityScreenMessages which don’t use TextScale so the bug is not visible. ScreenMessages use it and it is by default (0,0).

It is very easy to work around the bug as UEngine::ScreenMessages is public. so this is possible: FScreenMessageString* Message = GEngine->ScreenMessages.Find(Key);
if (Message != NULL)Message->TextScale.X = Message->TextScale.Y = 1.0f;

1 Like