There seems to be a strange bug on our designer’s machine (only) that causes the above convert function to report values that are offset up and to the left. We’re using this call to draw some reticle targeting widgets over some of our characters. They line up perfectly except on this one machine. Specifically the offset is (93, 153) pixels.
When we delete and resync the unreal Engine folder, the problem goes away…for a few days. It reared its head again today. This started when we upgraded to 4.6 (from 4.5), It ‘feels’ like there is stale data sitting around somewhere. It does NOT fix it when we only resync the project… must be the engine.
I’ve looked in the registry in case there’s some window dimension info stored there… but no luck. Any ideas? Is any of the data used in the projection or viewport matrices cached anywhere?
Well, it started happening on my machine today! Funny how it got a bit more attention cuz of this Here’s what I found: The file Engine/Saved/Config/Windows/EditorGameAgnostic.ini was causing the problem. A good file looked something like this:
Hey, just had the same problem (or something similar).
If you are using UMG and not pure slate to draw, which i just assume here, you need to use ‘Set Position in Viewport’ instead of the ‘Render Translation/Transform’ function. Also make sure you do not use sth like a Overlay Node with centered align or other Panels that align your content, or at least use them wise.
Here is a forum post i stumbled upon: [UMG and dynamic positions][1]
Hi gormed, thanks for the response. Turns out we are calling ‘Set Position in Viewport’. I’m pretty sure it’s the convert call. Luckily the .ini file has not reverted back to the borked version for us… knock on wood. When I manually set it, the problem returns.
The HHDrawText pretty much just calls HUD::DrawText, and it’s seeing the offset as well. It does seem to be the WorldToScreen (i’ve never seen this working though, it’s always been offset.)
When I check out where the thing is being rendered on screen, it does appear to be at the right pixel position accoding to the render call input. The values the world to screen function (bool APlayerController::ProjectWorldLocationToScreen(FVector WorldLocation, FVector2D& ScreenLocation) const
) retrurn, appear to be wrong.
Anecdotally, one of our team members reported that when he resized the viewport window it fixed the issue. Strange that it would affect the non-‘selected viewport’ play options, but anyways.
I just started getting the same issue and with the same logic (targeting overlay). However, this is 4.6 and I cannot seem to find the .ini file you noted as being the cause. Nothing seems to fix it for me unfortunately.
EDIT:
Found it. The scalability settings had my resolution set to 75% (auto detect).
this seems to make things worse, not better, for me. Also, what’s screen percent? The offset I’m seeing appears to be non-linear. Mostly a constant offset, with some linear scaling as the object gets nearer, but also odd behaviour at the edge of vision.
the issue seems to be that the screentopixel is using the ViewRect, not the UnscaledViewRect. You can see later in the source that the DeprojectFVector2D uses the UnscaledViewRect over the ViewRect, so this looks like an oversight in updating all the code that uses ViewRect while adding the function: