Search Issue Tracker
Fixed in 2022.1.X
Fixed in 2020.3.X, 2021.2.X
Votes
1
Found in
2020.3
2020.3.12f1
2021.1
2021.2
2022.1
Issue ID
1371559
Regression
Yes
[iOS] Crash when setting Screen.orientation at app launch
Reproduction steps:
1. Download and open the attached "1110973 - ScreenOrientationCrash.zip" project
2. Build and deploy the project to iOS
3. Observe the crash
Actual result: Crash with "Thread 1: "UnityDefaultViewController should be used only if unity is set to autorotate""
Reproducible with: 2020.3.0f1, 2020.3.20f1, 2021.1.25f1, 2021.2.0b15, 2022.1.0a12
Not reproducible with: 2019.4
Reproduced with: iPhone 12 Pro (iOS 14.2.1)
-
raphaelferras
Dec 07, 2021 11:14
This issue is also happening on 2018.4.36f1
-
marcin-walus
Oct 10, 2021 11:20
... or set Screen.orientation property in Start() method not in Awake().
-
marcin-walus
Oct 10, 2021 11:02
Hello.
I have exactly the same issue - I cannot run iOS app. I'm using Unity 2020.3.20. I do have one custom script in which in Awake() I'm setting Screen.orientation = ScreenOrientation.Portrait.
When I disable this line it works ok.Workaround: use coroutine to change orientation property. In my case in Awake() I'm starting coroutine and waiting 0.1f before setting orientation property.
private IEnumerator ChangeOrientation(ScreenOrientation screenOrientation)
{
yield return new WaitForSeconds(0.1f);
Screen.orientation = screenOrientation;
}
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
- SerializedPropertyChangeEvent is invoked when initially binding PropertyFields in custom Editor
- UI Panel is not visible when HDR and STP filter are enabled
- Crash on GfxDeviceD3D11Base::DrawBuffersIndirect when opening a specific project
- OnTriggerExit2D is called in Play mode when undoing component adding
- Builds fail with "Execution failed for task ':launcher:checkReleaseDuplicateClasses'" error when the newer version of the In-App Purchasing package is installed on a specific project
Resolution Note (fix version 2020.3):
Fixed in 2020.3.24f1