- Home /
Overriding Screen Orientation settings at runtime (iOS)
Hi,
I've been experimenting with iOS 9 beta 4's new features, namely split screen multitasking and for the most part it works very nicely on Unity 5.0.3p3!
That said, iOS 9 split screen multitasking requires that all four screen orientations be enabled (Portrait, Portrait Upside down, Landscape Right, Landscape Left).
This is not ideal for my game because although it scales decently, the experience is definitely subpar in portrait mode.
What I'd like to do is enable the screen rotations to satisfy the iOS requirement, but force Unity to only render the game in landscape mode. One way I thought of doing this is programmatically by setting the screen orientation settings when the game starts -- but this does not seem to be working.
Here's what I did exactly:
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
Screen.orientation = ScreenOrientation.AutoRotation;
Any thoughts? Would be a really great help!
Answer by allenallenallen · Aug 04, 2015 at 03:35 AM
I guess you have to enable all 4 autorotate options in order for multitasking to work in iOS 9. Most likely because Unity hasn't updated enough to deal with it yet. Either wait for a new Unity version that allows different combinations of autorotation or wait until iOS 9 to get out of beta.
You don't think there's a way to handle this programmatically? The Unity API seems to suggest that there is at least some degree of manual control possible.
Yeah, but it's not updated enough to deal with iOS 9's features yet.
Sure, it doesn't have explicit support -- but the feature works. I'd just like to hack it so that the screen orientation stays landscape no matter what. It's a bit hard to believe that's not possible to do code-wise.