Search Issue Tracker
Fixed in 2022.1.X
Fixed in 2020.3.X, 2021.2.X
[iOS] Crash when setting Screen.orientation at app launch
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)
Dec 07, 2021 11:14
This issue is also happening on 2018.4.36f1
Oct 10, 2021 11:20
... or set Screen.orientation property in Start() method not in Awake().
Oct 10, 2021 11:02
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;
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Graphics.DrawProcedural doesn't work like in DX11 when used with DX12
- [Quest 2] Running Entities Graphics/BatchRendererGroup under Vulkan results in a frame rate drop compared to OpenGLES 3 and causes Tile Binning to cost more
- Filters dropdown: Window doesn't rescale on items collapse
- Sprite Preview is broken when the Sprite is too tall or too wide
- Objects are invisible in Scene view when using Wireframe Shading Mode
Resolution Note (fix version 2020.3):
Fixed in 2020.3.24f1