Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2021.1

Issue ID

1276548

Regression

No

Toggling between Fullscreen and Windowed mode doesn't preserve native resolution triggering letterboxing

How to reproduce:
1. Open the attached project (link in the description)
2. Open the "SampleScene" Scene -> build and run on UWP
3. Click on the Sprite in the top right corner to expand the application window
4. Click on the Sprite to contract the window -> expand it again

Expected result: No extra space appears below and above the application (see Expected.png)
Actual result: Extra space appears below and above the application (see Actual.png)

Reproducible with: 2019.4.16f1, 2020.1.17f1, 2020.2.0b14, 2021.1.0a9

Notes:
- The issue does not appear on Standalone
- Could not test on 2018.4, because of Player build failing

UPDATE:

The issue, as originally described, is by-design: when using non-native resolutions in FullscreenWindow mode the aspect ratio of the app's display generally won't match the native desktop aspect ratio. To prevent distortion and/or clipping of the app, "letterboxing" is added; the size and orientation of the letterboxing depends on the degree to which the aspect ratios are mismatched.

The actual problem here is the Fullscreen resolution isn't preserved when toggling between Fullscreen and Windowed mode, but changes to the default 1200x900 resolution stored in PlayerPrefs.

  1. Resolution Note (2021.2.X):

    Switching to fullscreen mode from windowed mode using Screen.fullScreen property has historically respected the current rendering resolution and only changed the window dimensions. If the rendering resolution aspect ratio didn't match the monitor aspect ratio, Unity would introduce letterboxing. Unfortunately, changing this behaviour would break thousands of projects that depend on it.

    If you want to avoid letterboxing, use Screen.SetResolution() instead of simply flipping the Screen.fullScreen property.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.