Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Freezes when screen rotates

Discussion in 'iOS and tvOS' started by ttsato, Jul 14, 2023.

  1. ttsato

    ttsato

    Joined:
    Mar 21, 2020
    Posts:
    3
    As the title says.
    In our product, the app freezes when the screen is rotated, and the terminal does not accept operations.
    For confirmation, I made a sample app that rotates the screen vertically and horizontally when the button is pressed, and it was reproduced in that app as well.
    The screen switching is done with the following simple code.
    Code (CSharp):
    1. public class RotateSample : MonoBehaviour
    2. {
    3.     public Button RotateButton;
    4.     bool landscape = false;
    5.  
    6.  
    7.     void Start()
    8.     {
    9.         RotateButton.onClick.AddListener(OnClick);
    10.     }
    11.  
    12.     void OnClick()
    13.     {
    14.         if (landscape)
    15.         {
    16.             Screen.orientation = ScreenOrientation.LandscapeLeft;
    17.         }
    18.         else
    19.         {
    20.             Screen.orientation = ScreenOrientation.Portrait;
    21.         }
    22.  
    23.         landscape = !landscape;
    24.     }
    25. }
    This freeze doesn't happen all the time, sometimes it happens very rarely, sometimes it happens right away.

    Also, I'm using Firebase Crashlytics, but when it freezes, I'm having trouble sending crash logs etc.

    The version of Unity used and the terminal that freezes are as follows.
    Unity version: 2022.3.4 (sample app)
    Devices: iPad Air 4, iPad (gen 10) (both with A14 Bionic CPU)

    I would appreciate it if you could give me some information that would help me to solve the problem.
     
  2. joefspiro

    joefspiro

    Joined:
    Jan 6, 2022
    Posts:
    16
    To clarify what do you mean by "I'm using Firebase Crashlytics, but when it freezes, I'm having trouble sending crash logs etc."?

    Crash logs are submitted when you run again after a crash, ANR or other event. When doing so do you receive a stack trace? If so, posting them here will make it easier to determine what is happening.
     
  3. ttsato

    ttsato

    Joined:
    Mar 21, 2020
    Posts:
    3
    sorry.
    I'm not good at English, and as a result of using Google Translate, it seems that the sentences were difficult to understand.
    What I wanted to convey is as follows.
    ・The app uses Firebase Crashlytics
    ・However, the Crash log when the freeze occurs is not sent to Firebase
    ・Therefore, it is difficult to continue the investigation.

    Since there is no crash log, I have no clue to investigate, so I posted it on the Unity forum.

    Also, as a supplement, if this freeze occurs, you will not be able to operate the iPad at all. (You can also turn off the power)
    After a certain amount of time has passed, the screen will disappear and you will be able to use it again.
     
  4. hieunguyen52ent

    hieunguyen52ent

    Joined:
    Oct 5, 2016
    Posts:
    5
  5. ttsato

    ttsato

    Joined:
    Mar 21, 2020
    Posts:
    3
    Tried it and no more freezes!
    you really helped me out. I can't thank you enough.
    Thank you!!
     
  6. joefspiro

    joefspiro

    Joined:
    Jan 6, 2022
    Posts:
    16
    Just to clarify, is it not sent the next time you run the app? It should not be sent until the next run. Please check then. If its not available at that time, I'd be curious to know more. If it does report something though I would be interested to lnow if it corresponds to the code from github.
     
  7. vTrotta_Ulu

    vTrotta_Ulu

    Joined:
    Aug 6, 2020
    Posts:
    4
    @joefspiro
    We also have this issue, and there seems to be no way on our end to catch it with analytics. The app never actually crash. It's iOS that crash after the rendering has been frozen for some time, forcing a device restart. The only way we have had to figure it out were user complaints and then some imperfect analytics ways to figure out abnormal amounts of improper app closures.

    This is a hard to detect and serious issue affecting common devices. Unity should really take this one seriously.