Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4.8f1
2020.2
Issue ID
1273302
Regression
No
[tvOS] Screen.safeArea returns incorrect result
Reproduction steps:
1. Open project in "SafeArea.zip"
2. Open "SampleScene.unity" and build the project for tvOS
3. Deploy the project to an Apple TV using Xcode
4. Screen.safeArea will be printed in Xcode console
5. Inspect the Xcode console
Expected result: when using a 1920 x 1080 monitor: Safe Area (x:0.00, y:0.00, width:1920, height:1080) will be returned
Actual result: when using a 1920 x 1080 monitor: Safe Area (x:90.00, y:60.00, width:1740.00, height:960.00) is returned
Reproducible with: 2018.4.27f1, 2019.3.0a1, 2019.4.8f1, 2020.1.4f1, 2020.2.0b1
Devices tested:
AppleTV A1625 (32GB) , tvOS 13.3.1
AppleTV 4K, tvOS 13.4.8 (expected actual numbers in edits)
Note: not reproducible on iOS
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- The Scene View becomes gray and "NullReferenceException" errors are thrown when attaching the Unity Editor process to RenderDoc
- Memory usage rapidly rises when changing colors in the color wheel
- Physically Based Sky's Horizon and Zenith Tint Color Selection Bars don't have immediate access to color pickers
- EmptyAdditionalLightShadowmapTexture leaks from memory when URP quality level is changed using QualitySettings.SetQualityLevel
- Referenced ScriptableObject field does not get updated and cannot be set to "None" when there are no Objects of that type
Resolution Note (2021.1.X):
After some investigations I confirm that Screen.safeArea is returning the correct values, based on the device view safe area values. Which is something not calculated in Unity, but at the tvOS device level.
In UnityView.mm, ComputeSafeArea reports the {0,0,1920,1080} safe area only during the splash screen. Any calls to ComputeSafeArea after the splash screen return {80,60,1760,960} on the monitor I used for testing.
The way we calculate the safe area is by offsetting screen the resolution values using the safeAreaInsets view property. In tvOS, the safe area also includes the screen’s overscan insets, which represent the area covered by the screen’s bezel. More info here:
https://developer.apple.com/documentation/uikit/uiview/positioning_content_relative_to_the_safe_area?language=objc
Regarding the insets values being {0,0,0,0} during the first splash screen frames (causing the calculated safe area to match the full screen resolution on those frames): If the view is not currently installed in a view hierarchy, or is not yet visible onscreen, the edge insets in this property are 0.
More info here:
https://developer.apple.com/documentation/uikit/uiview/2891103-safeareainsets?language=objc
I attached image shows that the values returned by ComputeSafeArea() are matching the results of the API Screen.safeArea when the API call.