Search Issue Tracker
Fixed in 2017.2.0f3
Fixed in 5.4.X, 5.5.X, 5.6.X, 2017.1.X
Votes
200
Found in
5.4.0f3
Issue ID
835745
Regression
No
[iOS] Changing the screen orientation via a script sometimes results in corrupted view on iOS 10
When the orientation of the screen is changed via a script (with Screen.orientation) on iOS 10 devices, sometimes the screen remains in portrait orientation, but the game view gets flipped and goes over the edge of the screen and leaves black area in the bottom part of the screen.
Steps to reproduce:
1) Open the attached project.
2) Build 'MainScene' for iOS.
3) Run on an iOS 10 device.
4) Press the 'Switch to landscape' UI button.
If the button is clicked 2-3 seconds after launch - the rotation should fail - black area appears at the bottom of the screen, half of the game view is not visible. If it does not, quit the app completely, re-launch it and repeat step 5). This occurs with both Metal and OpenGLES on iOS 10.
Reproduced on:
5.5.0b5, 5.4.1p3, 5.3.6p6
Devices:
iPhone 7 iOS 10 - reproduced
iPhone 7 iOS 10.1 - reproduced
iPhone 7 Plus iOS 10.0.2 - reproduced
iPhone 5 iOS 10 - not reproduced
iPad Mini 2 iOS 10 - not reproduced
iPhone 5S iOS 9.2.1 - not reproduced
It should also be reproducible on iPhone 6.
iPhone 6S iOS 10.2 - reproducible
------------------------
Fixed in 2017.1.0b10, 5.6.2p1, 5.5.4p1, 5.4.5p4
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- GetCurrentAnimatorClipInfoCount() and GetNextAnimatorClipInfoCount() return 0 when animator is in transition
- GPU utilization increases by 20% on Meta Quest headsets when Render Graph is enabled on 6000.0.16f1 and higher
- Value on Slider (Int) control in UI Builder displays as default when saving UI Document
- Color mismatch in UI Builders Library panel when the Editors theme is set to Light Mode
- [Android ] "AndroidJNI.ToBooleanArray" returns a random non-zero value instead of "IntPtr.Zero" when the method argument is null
matbou
Dec 01, 2016 11:27
Got the same issue using Unity 5.4.2f2.
It's a really severe issue for us. Please fix.
FSpark
Nov 30, 2016 17:56
In case this helps anyone - I raised a similar issue where the iOS device (iOS 10) the UI appeared locked and display distorted on resuming app after extended sleep (see https://fogbugz.unity3d.com/default.asp?846895_82ts9nnt8gm5rp25 ).
The quick workaround I used was to modify the Unity generated UnityAppController.mm:
- (void)applicationWillEnterForeground:(UIApplication*)application
{
::printf("-> applicationWillEnterForeground()\n");
// applicationWillEnterForeground: might sometimes arrive *before* actually initing unity (e.g. locking on startup)
if(_unityAppReady)
{
// if we were showing video before going to background - the view size may be changed while we are in background
[GetAppController().unityView recreateGLESSurfaceIfNeeded];
}
//
// Bug workaround:
// On returning from device sleep mode, Unity UI is lock and will not respond
// If the device is rotated, Unity will 'wake up'
// So force landscape orientation to wake up Unity
//
[[UIDevice currentDevice] orientation];
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
switch( [[UIDevice currentDevice] orientation] )
{
case UIDeviceOrientationPortrait:
value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
break;
case UIDeviceOrientationPortraitUpsideDown:
value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
break;
case UIDeviceOrientationLandscapeLeft:
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
break;
case UIDeviceOrientationLandscapeRight:
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
break;
default:
// setting to portrait does not work
// value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
// but forcing the device into landscape mode and then allow it to auto-correct works
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
break;
};
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
jimmyzhao
Nov 30, 2016 08:42
Reproduced this issue in iphon5s, iphone6, etc. with Unity 5.3.4f1
pls fix..
Krellumdaed
Nov 23, 2016 01:57
On a current game we are developing we are seeing a solid color full screen when we run on new iPhone 7 Plus. Have people seen this problem manifest as it hanging with the background color filled in but before the full opening scene has been rendered?
Sigmund1
Nov 15, 2016 04:41
Workaround: In the info.plist file, go to "Supported Orientations" and add portrait (I also move it to index 1 instead of 0). This will fix the screen issue but mess the splash screen up on some devices. This fix worked for me, so from what I can tell if you make a portrait version of your Splash Screen art (Rotate it 90 degrees).
I added both images to the splash screen in Unity Player Editor and they appeared in my Xcode project file. Go to "Launchscreen-iPhone.xib", once you have selected a canvas and the XIB has loaded, click the bottom where the screen measurements are. This will open the device and orientation selector menu make sure you have it set to portrait.
Now head to the hierarchy and and create a new View and call it something like "ViewP" (you can add things to the xib by using the toolbox in the bottom right, for those who don't use Xcode), on the right enter the attributes selector, scroll to the bottom where it says "Installed", uncheck that and hit the small plus symbol to the right, if you have the view set to portrait, just click Add Variation, this will set the view to only activate in portrait screen.
From there add an Image View and change the "Image" option in the attributes selector to your portrait image. I'm not 100% on what I did with the constraints but essentially what you want is to have it stay the same through all the different screen sizes, from there you should be good!.
Hope this helps folks. Cheers.
Sigmund1
Nov 15, 2016 02:10
Having the same issue with + devices in Unity 5.4.2f2 personal edition. Currently testing a work around in Xcode. Will re-comment if the test is successful
ptblk
Nov 14, 2016 05:01
Guys please vote for this to be solved, dont just comment
punkrockchicken
Oct 30, 2016 19:45
Having the same awkward issue!
ptblk
Oct 25, 2016 12:01
Please fix, this is a stupid issue that should not exist
dadamox
Oct 21, 2016 21:14
Also does a mini glitch sometimes on Android.. FIX this ASAP!!!