Search Unity

Fullscreen is broken in UWP builds, distorting the image (resizing the window has issues too)

Discussion in 'Windows' started by CanisLupus, Nov 11, 2019.

  1. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    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:

    1. Build for UWP (D3D or XAML don't seem to make a difference).
    2. Play the build in Visual Studio (Debug x64, but probably anything will do).
    3. The build starts in full screen but the image display MAY be compressed and have black sections (not always).
    4. Press the Microsoft Store app "window" button (de-maximise) in the top right corner (or press Win+Shift+Enter).
    5. Notice that the display is distorted, since the window does not show the whole image (see screenshot "distorted image").
    6. 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.
    7. 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!
     

    Attached Files:

  2. dcheglakov

    dcheglakov

    Joined:
    Aug 11, 2014
    Posts:
    34
    Same problem.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    We're looking at this.
     
  4. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    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.
     
  6. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Got it, thanks. I'll be waiting for news.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Okay, you have two options:

    1. Downgrade to Unity 2019.2.8f1. This problem got introduced in Unity 2019.2.9f1.
    2. Add this script to any object in your scene:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class FixFullscreen : MonoBehaviour
    4. {
    5.     void Start()
    6.     {
    7. #if UNITY_WSA
    8.         UnityEngine.WSA.Application.windowSizeChanged += Application_windowSizeChanged;
    9. #endif
    10.     }
    11.  
    12. #if UNITY_WSA
    13.     private void Application_windowSizeChanged(int width, int height)
    14.     {
    15.         if (!Screen.fullScreen)
    16.             Screen.SetResolution(width, height, false);
    17.     }
    18. #endif
    19. }
    I'm trying to get the fix into 2019.2 ASAP.
     
  8. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    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:

    This already happened before using your script, though. Not sure if this is important, but letting you know.

    Cheers!
     
  9. dcheglakov

    dcheglakov

    Joined:
    Aug 11, 2014
    Posts:
    34
    @Tautvydas-Zilys thank you.
    This helps us.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Those aren't anything to be worried about. They're internal windows logs - I don't even know why they're visible publicly.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    The fix for this issue landed to 2019.2.0f16.
     
  12. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    @Tautvydas-Zilys Do you mean 2019.2.16f1? (Since we are currently at 2019.2.14)
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Correct, that was a typo. It's fixed in 2019.2.16f1.
     
    CanisLupus likes this.