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

Mobile

-

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)

  1. Resolution Note (fix version 2020.3):

    Fixed in 2020.3.24f1

Comments (3)

  1. raphaelferras

    Dec 07, 2021 11:14

    This issue is also happening on 2018.4.36f1

  2. marcin-walus

    Oct 10, 2021 11:20

    ... or set Screen.orientation property in Start() method not in Awake().

  3. 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

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.