UWP builds have the transition from true fullscreen to windowed mode broken, either when using the de-maximize button in the top right or Win+Shift+Enter. Resizing the window seems to distort the display for a few frames too.
This happens on 2019.2.11f1. Did not happen on 2017.4.11f1.
I’ve submitted a bug report (case 1197778) but want to know if there’s any possible workaround in the meantime.
I’ve attached the same project that I submitted for the report. Reproduction steps:
Build for UWP (D3D or XAML don’t seem to make a difference).
Play the build in Visual Studio (Debug x64, but probably anything will do).
The build starts in full screen but the image display MAY be compressed and have black sections (not always).
Press the Microsoft Store app “window” button (de-maximise) in the top right corner (or press Win+Shift+Enter).
Notice that the display is distorted, since the window does not show the whole image (see screenshot “distorted image”).
Drag the window edges and it will finally return to normal (see screenshot “correct image”), but you may notice that it takes at least one frame to do that, stretching/compressing the image until it updates.
If we return to true full screen again (using Win+Shift+Enter) and back to windowed, the distortion happens. You may also notice black lines of pixels near the edges after de-maximizing or dragging the window edges.
Any help is appreciated!
5162870–511955–Full Screen UWP demo.zip (293 KB)
@Tautvydas-Zilys
I was told in my bug report that the team was already aware and that this new issue tracks it:
(I added a comment because Master builds also cause the problem for us.)
In the meantime, is there anything we can do to fix this? Or is it up to a future Unity update?
I hope to have an update for you early next week on this. I don’t know if there’s a way to work around it yet.
Got it, thanks. I’ll be waiting for news.
Okay, you have two options:
Downgrade to Unity 2019.2.8f1. This problem got introduced in Unity 2019.2.9f1.
Add this script to any object in your scene:
using UnityEngine;
public class FixFullscreen : MonoBehaviour
{
void Start()
{
#if UNITY_WSA
UnityEngine.WSA.Application.windowSizeChanged += Application_windowSizeChanged;
#endif
}
#if UNITY_WSA
private void Application_windowSizeChanged(int width, int height)
{
if (!Screen.fullScreen)
Screen.SetResolution(width, height, false);
}
#endif
}
I’m trying to get the fix into 2019.2 ASAP.
Great, thanks @Tautvydas-Zilys !
We also seem to be getting these kinds of logs in VS when resizing the screen, even on Master UWP builds:
[0.010436 / 26.752404] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1361.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(455) tid(51b8) 80070490 Element not found.
[0.006104 / 26.758509] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1404.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(456) tid(51b8) 80070490 Element not found.
[0.007708 / 26.766216] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1445.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(457) tid(51b8) 80070490 Element not found.
[0.007664 / 26.773881] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1486.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(458) tid(51b8) 80070490 Element not found.
[0.007948 / 26.781829] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1516.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(459) tid(51b8) 80070490 Element not found.
[0.010210 / 26.792039] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1538.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(460) tid(51b8) 80070490 Element not found.
[0.008584 / 26.800624] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1552.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(461) tid(51b8) 80070490 Element not found.
[0.005831 / 26.806454] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1562.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(462) tid(51b8) 80070490 Element not found.
[0.007803 / 26.814257] - OnCoreWindowSizeChanged event (-1718.00, -1718.00, 1567.00, 1159.00), m_Initialized=True.
onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!00007FFEE4EF04B0: (caller: 00007FFEE4EF017A) ReturnHr(463) tid(51b8) 80070490 Element not found.
This already happened before using your script, though. Not sure if this is important, but letting you know.
Cheers!
@Tautvydas-Zilys thank you.
Tautvydas-Zilys:
Add this script to any object in your scene:
This helps us.
Those aren’t anything to be worried about. They’re internal windows logs - I don’t even know why they’re visible publicly.
The fix for this issue landed to 2019.2.0f16.
@Tautvydas-Zilys Do you mean 2019.2.16f1? (Since we are currently at 2019.2.14)
Correct, that was a typo. It’s fixed in 2019.2.16f1.
1 Like