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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Major rotate/landscape/portrait bug in iOS8.

Discussion in 'UGUI & TextMesh Pro' started by unity_3d_user, Sep 20, 2014.

  1. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    Hi,

    I just filed a bug about in Unity 4.6 beta, on iOS, the app is incorrectly rotated, and most of the time, a large portion of the screen is missing.

    To repro, just send a build to an iOS8 device that is supposed to be landscape-left.

    In code I try to reset it again, though that hasn't helped.

    Anyone have an idea about a possible work-around, in either Unity or Xcode6?
     
  2. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    Fixed locally. Just did this below, as it works for the ScreenOrientations I currently support.

    iPhone_OrientationSupport.mm

    Code (CSharp):
    1. CGAffineTransform TransformForOrientation(ScreenOrientation orient)
    2. {
    3.     return CGAffineTransformIdentity;
    4.     /*
    5.     switch(orient)
    6.     {
    7.         case portrait:              return CGAffineTransformIdentity;
    8.         case portraitUpsideDown:    return CGAffineTransformMakeRotation(M_PI);
    9.         case landscapeLeft:         return CGAffineTransformMakeRotation(M_PI_2);
    10.         case landscapeRight:        return CGAffineTransformMakeRotation(-M_PI_2);
    11.  
    12.         default:                    return CGAffineTransformIdentity;
    13.     }
    14.     return CGAffineTransformIdentity;
    15.      */
    16. }
     
  3. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    Oddly enough, it seemingly randomly stopped working. Trying to find out why.
     
  4. Peter99

    Peter99

    Joined:
    Jan 18, 2013
    Posts:
    9
    I'm facing the same problem here. I'm working with Unity 4.6 Beta 18 + iOS 8...
     
    psyydack likes this.
  5. Peter99

    Peter99

    Joined:
    Jan 18, 2013
    Posts:
    9
    this is odd... bizarre.
    Check last comment,

    Code (CSharp):
    1. ScreenOrientation ConvertToUnityScreenOrientation(UIInterfaceOrientation hwOrient, EnabledOrientation* outAutorotOrient)
    2. {
    3.     EnabledOrientation autorotOrient     = autorotPortrait;
    4.     ScreenOrientation  unityScreenOrient = portrait;
    5.  
    6.     switch (hwOrient)
    7.     {
    8.         case UIInterfaceOrientationPortrait:
    9.             autorotOrient     = autorotPortrait;
    10.             unityScreenOrient = portrait;
    11.             break;
    12.         case UIInterfaceOrientationPortraitUpsideDown:
    13.             autorotOrient     = autorotPortraitUpsideDown;
    14.             unityScreenOrient = portraitUpsideDown;
    15.             break;
    16.         // landscape left/right have switched values in device/screen orientation
    17.         // though unity docs are adjusted with device orientation values, so swap here
    18.         case UIInterfaceOrientationLandscapeLeft:
    19.             autorotOrient     = autorotLandscapeRight;
    20.             unityScreenOrient = landscapeRight;
    21.             break;
    22.         case UIInterfaceOrientationLandscapeRight:
    23.             autorotOrient     = autorotLandscapeLeft;
    24.             unityScreenOrient = landscapeLeft;
    25.             break;
    26.     }
    27.  
    28.     if (outAutorotOrient)
    29.         *outAutorotOrient = autorotOrient;
    30.  
    31.    // return unityScreenOrient;
    32.    return portrait; // Now works in Landscape >.<
    33. }
     
  6. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    Hmm, that does fix it, however, the UI partially stops working and the splash screen is still incorrect.
     
    Last edited: Sep 21, 2014
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,183
    Hi can you raise a bug about this? We need to get the iOS team to look at it.
     
  8. mentis-developer

    mentis-developer

    Joined:
    Aug 28, 2014
    Posts:
    3
    We managed to fix the problem editing the following line of code from iPhone_OrientationSupport.mm.

    Line 84:
    change from
    Code (CSharp):
    1. CGAffineTransform transform = _ios80orNewer ? TransformBetweenOrientations(fromController, to) : TransformForOrientation(to);
    to
    Code (CSharp):
    1. CGAffineTransform transform = TransformForOrientation(to);
    After this change, everything works perfectly (including splash screen).
     
    aylerliu and psyydack like this.
  9. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,183
    Hi, I believe this was fixed in 4.5.4patch1. We will get this fix into UI when 4.5.5 becomes available (we are not taking patch releases).
     
  10. RedDevil

    RedDevil

    Joined:
    Nov 19, 2013
    Posts:
    8
    Hi. Can you please tell us an approximate date when this update will go up because my work place got hit pretty hard by this problem.
     
  11. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    well the 4.5.X patch releases go out about every week and i think they do a new version after 4ish patch releases. so 4.5.5 would be mid - late october (guessing). 4.6 would then need to pull that release and do a new beta so possibly late october...??

    For now i would recommend taking a look at the iPhone_OrientationSupport.mm that is shipped with 4.5.4 and then using that in your 4.6 xcode project. This might not work as havnt tested it (and i dont know where the change acctually took place) but it could fix your issue for now.
     
  12. RedDevil

    RedDevil

    Joined:
    Nov 19, 2013
    Posts:
    8
    Thank you for your answer.
    i think that for now ill just downgrade to the 4.5.4 version and just wait for 4.6 to release.
     
  13. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    Did you change anything else? This doesn't appear to be working for me. Currently using land-scape-left.

    Could someone possible post the entirety of the iPhone_OrientationSupport.mm that shipped with 4.5.4? I already have several Unity installs, don't want to add another one. :)
     
  14. Peter99

    Peter99

    Joined:
    Jan 18, 2013
    Posts:
    9
    Didn't work for me neither. I also appreciate the entire iPhone_Orientation.mm code.
     
  15. Peter99

    Peter99

    Joined:
    Jan 18, 2013
    Posts:
    9
    Beta19 was released. Have you tried it unity_3d_user?
     
  16. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    Haven't. The release notes don't mention any kind of fix for it.
     
  17. Peter99

    Peter99

    Joined:
    Jan 18, 2013
    Posts:
    9
    I've tested it now. Fixed! =)
     
  18. unity_3d_user

    unity_3d_user

    Joined:
    Sep 12, 2014
    Posts:
    18
    You mean beta-19 fixes this? :)
     
  19. psyydack

    psyydack

    Joined:
    Aug 30, 2013
    Posts:
    93
    It's fixed now with new beta 19 =)
     
  20. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,183
    Oh thats cool :) I though we had missed this fix for this release.
     
  21. BabyRuman

    BabyRuman

    Joined:
    Jan 22, 2014
    Posts:
    4
    it's works fine ;)

    I use Unity 4.3.4f1.
     
  22. ymerk

    ymerk

    Joined:
    Nov 1, 2012
    Posts:
    4
    thanks. Great with a fix! I am using Unity 3, how do we fix this issue?
     
  23. ymerk

    ymerk

    Joined:
    Nov 1, 2012
    Posts:
    4
    bump.

    So we are working in Unity 3.5.7. We cant upload to the app store because of this issue. I can see that it was fixed in the new beta release of unity version 4.6, but that does not help us when working in the older Unity version.
    Anyone have any luck with unity 3 or have any ideas?
     
  24. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Chances are you won't get any replies as this is the 4.6 beta forum so most people here are using 4.6 or at least 4.5 and no v3.
     
  25. ymerk

    ymerk

    Joined:
    Nov 1, 2012
    Posts:
    4
    Oh. I didn't know. Thanks for that reply
     
  26. tyoc213

    tyoc213

    Joined:
    Nov 14, 2011
    Posts:
    168
    I still have problems with 4.6 (final) and iOS8 about screen orientation (I only allow portrait and landscape) and set it with

    Screen.orientation = some;

    Not only I can't click on a button, but if you hit on/off button and enter again iPad, I get part of my game outside the window and a black bar...
     
    Last edited: Dec 9, 2014