Packaged game in full screen in native resolution

I’d like my packaged game to start in full screen mode in the display’s native resolution on Windows. This question has been asked several times on the answerhub and forums but they are either for a very old version of the engine, or simply doesn’t work.

So from previous discussions I have found that I should create a DefaultGameUserSettings.ini file with the following settings to obtain full screen:

[/Script/Engine.GameUserSettings]
 bUseVSync=True 
 WindowPosX=-1
 WindowPosY=-1
 bUseDesktopResolution=True
 FullscreenMode=0
 LastConfirmedFullscreenMode=0
 PreferredFullscreenMode=0 
 Version=5

This seems to work fine, EXCEPT the first time the application is launched. If dpi scaling is enabled in Windows (I have 150% scaling on my 4k display), the game scales the resolution accordingly rather than using native resolution.
So on a 3840x2160 I instead get 2560x1440.

However, when exiting the game and starting it again, it starts in 3840x2160 like it should. Why does this work the second time, but not the first?

I can prevent this behavior by right clicking the exe-file and in properties/compatibility check “override high dpi scaling behavior performed by application”. But I haven’t found a good way to achieve this directly in the packaged game, and the option to check the override setting is of course not available when shipping to customers.

Not only does this cause the game to not utilize all the pixels of the display, it also causes artifacts on other apps running, and flickering on the secondary display.

Got the same issue. The engine itself probably thinks your desktop resolution is lower. If you try Get Game User Settings → Get Desktop Resolution, it will output 2560x1440 while you’re actually at 4K with a 150% DPI scaling. Still have no workaround on that.

Upgrading to 4.19 seems to have taken care of this issue for us.