Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug unity screen orientation on mobile

Discussion in 'iOS and tvOS' started by zhourui01, May 17, 2024.

  1. zhourui01

    zhourui01

    Joined:
    Jul 11, 2021
    Posts:
    2
    AutoRotation is set up in Unity's playersettngs, and landscape left and landscape right are checked. The desired result is that after running the game, the screen will always be horizontal, and the left and right horizontal screens will automatically flip according to the phone. However, the result of running on the iPhone is that It has to do with whether the phone itself locks the vertical screen.
    When the vertical screen is locked, the game can automatically flip once each time it gains focus, and then cannot flip automatically again. When the vertical screen is turned off, the game can automatically flip normally.
    This situation is the same on the Android system, but the Android system can achieve automatic flipping when the vertical screen is locked by forcibly calling the activity's setRequestedOrientation every frame.
    But ios was not found. I searched for the oc code in the exported xcode project, modified EnabledAutorotationInterfaceOrientations and other codes that may be related to screen rotation, but still had no effect.
    unity2022.3.13f1,unity2023.2.3f1
     
  2. zhourui01

    zhourui01

    Joined:
    Jul 11, 2021
    Posts:
    2
    no one has the same problom?