Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.35f1

2022.3.20f1

2023.2.12f1

2023.3.0b9

2024.1.0a1

6000.0.0b11

Issue ID

UUM-64902

Regression

No

[iOS] Status Bar is not visible when using UnityFramework (UAAL) with Status Bar Hidden setting disabled

--

-

*Steps to reproduce:*

1. Open "Unity Project" from [Uaal-example|https://github.com/Unity-Technologies/uaal-example?tab=readme-ov-file]

2. Go to File > Build Settings and switch to iOS Platform

3. Go to Edit > Project Settings > Player > Resolution and Presentation

4. Disable Status Bar Hidden setting

5. By following these [steps|https://github.com/Unity-Technologies/uaal-example/blob/master/docs/ios.md] deploy to the device

6. In the Native app press Init

7. Observe the Status Bar

*Actual results:* Status Bar says hidden

*Expected results:* Status Bar is visible

*Reproducible with versions:* 2021.3.35f1, 2022.3.20f1, 2023.2.12f1, 2023.3.0b9

*Reproducible with devices:*
* VLNQA00604 - iPhone 15 Pro Max (MU773PX/A), CPU: Apple A17 Pro, OS: 17.0.2
* VLNQA00258 - iPhone Xs Max (MT502ET/A), CPU: Apple A12 Bionic, GPU: Apple designed, OS: 14.4

*Notes:*
* Not reproducible with simple empty project

  1. Resolution Note:

    Status Bar Hidden checkbox in Unity player settings writes YES/NO for key "UIStatusBarHidden" in Info.plist
    https://developer.apple.com/documentation/bundleresources/information_property_list/uistatusbarhidden?language=objc

    Which works in a regular Unity app because we read it from "MainBundle" to then set (BOOL)prefersStatusBarHidden (https://developer.apple.com/documentation/uikit/uiviewcontroller/1621440-prefersstatusbarhidden?language=objc)

    However, when Unity is used as UAAL in another app, that native app is the "MainBundle" and does not contain such value in Info.plist (Unless the developer of the native app adds it) and so Unity fallbacks to YES (hide status bar) (Check UnityViewControllerbase+iOS.mm in Classes/UI of the generated Xcode project)

    As the use of "Unity as a Library" is expected to be done by experienced native app developers, it is also expected that the developers will control the status bar themselves.

    Another relevant plist setting is UIViewControllerBasedStatusBarAppearance (https://developer.apple.com/documentation/bundleresources/information_property_list/uiviewcontrollerbasedstatusbarappearance?language=objc) which will make Unity respect the status bar visibility of the main app if set to NO.

    It is also possible to control the status bar visibility programatically, by setting prefersStatusBarHidden in the view controller and then calling setNeedsStatusBarAppearanceUpdate (https://developer.apple.com/documentation/uikit/uiviewcontroller/1621354-setneedsstatusbarappearanceupdat?language=objc), for example when loading or unloading UnityFramework

    Also, honorable mention of childViewControllerForStatusBarHidden for even more advanced scenarios
    https://developer.apple.com/documentation/uikit/uiviewcontroller/1621451-childviewcontrollerforstatusbarh?language=objc

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.