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
helios
Dec 17, 2016 23:01
This is an absolutely abysmal bug - This is not fixed even in 5.5p1. The game crashes when unlocking your phone if you've gone into portrait mode. Iphone 6 with iOS 10 here. Run game which is landscape. Lock phone. Turn phone into portrait while locked. Unlock the phone and the game crashes. It doesn't crash if you keep your phone in landscape and unlock that way.
matbou
Dec 14, 2016 22:52
I have noticed that the severity of this issue is 3, meaning "workaround is possible", which absolutely not the case.
So please increase the severity of this issue, and fix it asap. It is really a terrible bug!
MechEthan
Dec 13, 2016 21:34
None of the posted workarounds works for our situation, but we came up with one that does!
Here's a link to the basics of our current workaround: https://gist.github.com/Ethan-VisualVocal/286ebae00eb3100885b19c90e8b9ff52
Context: Our app starts in Portrait, has autorotate disabled, and we explicitly force LandscapeLeft upon loading a "level" -- this step of explicitly changing from Portrait to LandscapeLeft causes the bug to appear almost 50% of the time on iOS 10.
DarkMagicCK
Dec 12, 2016 13:31
Though, this causes wired auto rotation for our users when they bring our game front Background to Front, That's wired, and I dont know if Apple will reject our app because it behaves strange, just like a bug.
Hope this bug would be fixed soon.
DarkMagicCK
Dec 12, 2016 13:26
Thanks to FSPARK's workaround, but the code will till crash our app.
After digging in our game, I found the app only crashes in this situation:
(Our game only supports landscape left and right)
1. Open your game
2. Get in any scenes which is somewhat complex.(Very simple scenes does not crash in our game)
3. Lock your iphone.
4. After ApplicationDidEnterBackground, unlock your iPhone with portrait orientation;
5. Game crash.
And with FSPARK's code, the app still crash when you set the device orientation to the same when you lock your iPhone. The screen do not auto rotate to wakeup Unity.
So we changed the code a little, to always rotate the app to the opposite landscape, and the app does not crash any more. Here's the code:
UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
NSNumber *value = [NSNumber numberWithInt:UIDeviceOrientationLandscapeRight];
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
value = [NSNumber numberWithInt:UIDeviceOrientationLandscapeLeft];
}else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight){
value = [NSNumber numberWithInt:UIDeviceOrientationLandscapeRight];
}
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
ptblk
Dec 08, 2016 20:33
if you dont vote for it, it wont be fixed. Just commenting here doesnt help
MechEthan
Dec 08, 2016 17:40
Unfortunately, we just got our first submission rejected by Apple over this.
Since this issue has been around since iOS 10 shipped, I guess we will have to try FSpark's workaround!
Mohammad-Faisal-Aleem
Dec 06, 2016 15:40
Voted.
dttson91
Dec 06, 2016 14:11
Everyone please vote, don't just comments, there are only 9 votes left to raised this issue to Unity
Mohammad-Faisal-Aleem
Dec 05, 2016 22:36
Does anybody have found a proper fix for it. Have unity fixed this issue in some version above 5.4.x series? I am also stuck in this. It should have been answered or handled till now.