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?
Fixed locally . Just did this below, as it works for the ScreenOrientations I currently support.
iPhone_OrientationSupport.mm
CGAffineTransform TransformForOrientation(ScreenOrientation orient)
{
return CGAffineTransformIdentity;
/*
switch(orient)
{
case portrait: return CGAffineTransformIdentity;
case portraitUpsideDown: return CGAffineTransformMakeRotation(M_PI);
case landscapeLeft: return CGAffineTransformMakeRotation(M_PI_2);
case landscapeRight: return CGAffineTransformMakeRotation(-M_PI_2);
default: return CGAffineTransformIdentity;
}
return CGAffineTransformIdentity;
*/
}
Oddly enough, it seemingly randomly stopped working. Trying to find out why.
Peter99
September 21, 2014, 12:22am
4
I’m facing the same problem here. I’m working with Unity 4.6 Beta 18 + iOS 8…
1 Like
Peter99
September 21, 2014, 12:45am
5
this is odd… bizarre.
Check last comment,
ScreenOrientation ConvertToUnityScreenOrientation(UIInterfaceOrientation hwOrient, EnabledOrientation* outAutorotOrient)
{
EnabledOrientation autorotOrient = autorotPortrait;
ScreenOrientation unityScreenOrient = portrait;
switch (hwOrient)
{
case UIInterfaceOrientationPortrait:
autorotOrient = autorotPortrait;
unityScreenOrient = portrait;
break;
case UIInterfaceOrientationPortraitUpsideDown:
autorotOrient = autorotPortraitUpsideDown;
unityScreenOrient = portraitUpsideDown;
break;
// landscape left/right have switched values in device/screen orientation
// though unity docs are adjusted with device orientation values, so swap here
case UIInterfaceOrientationLandscapeLeft:
autorotOrient = autorotLandscapeRight;
unityScreenOrient = landscapeRight;
break;
case UIInterfaceOrientationLandscapeRight:
autorotOrient = autorotLandscapeLeft;
unityScreenOrient = landscapeLeft;
break;
}
if (outAutorotOrient)
*outAutorotOrient = autorotOrient;
// return unityScreenOrient;
return portrait; // Now works in Landscape >.<
}
Hmm, that does fix it, however, the UI partially stops working and the splash screen is still incorrect.
Tim-C
September 22, 2014, 9:44am
7
Hi can you raise a bug about this? We need to get the iOS team to look at it.
We managed to fix the problem editing the following line of code from iPhone_OrientationSupport.mm.
Line 84:
change from
CGAffineTransform transform = _ios80orNewer ? TransformBetweenOrientations(fromController, to) : TransformForOrientation(to);
to
CGAffineTransform transform = TransformForOrientation(to);
After this change, everything works perfectly (including splash screen).
2 Likes
Tim-C
September 22, 2014, 12:59pm
9
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).
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.
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.
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.
We managed to fix the problem editing the following line of code from iPhone_OrientationSupport.mm.
Line 84:
change from
CGAffineTransform transform = _ios80orNewer ? TransformBetweenOrientations(fromController, to) : TransformForOrientation(to);
to
CGAffineTransform transform = TransformForOrientation(to);
After this change, everything works perfectly (including splash screen).
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.
Peter99
September 23, 2014, 8:16pm
14
Didn’t work for me neither. I also appreciate the entire iPhone_Orientation.mm code.
Peter99
September 23, 2014, 8:18pm
15
Beta19 was released. Have you tried it unity_3d_user?
Haven’t. The release notes don’t mention any kind of fix for it.
Peter99
September 24, 2014, 1:43am
17
I’ve tested it now. Fixed! =)
You mean beta-19 fixes this?
It’s fixed now with new beta 19 =)
Tim-C
September 24, 2014, 9:24am
20
Oh thats cool I though we had missed this fix for this release.