- Home /
Screen.orientation not working on iOS devices [Unity 5.5.1p3]
Hi,
I'm having an issue with Screen.orientation.
The thing is that I am making a game which its default configuration is auto-rotation with landscape right and left selected. There's a time inside the game when it has to be in portrait mode so I set
Screen.orientation = ScreenOrientation.Portrait;
On Android this works as expected, the game turns into portrait mode (without even turning the device, it forces the change which is exactly the behavior I want).
But on iOS nothing happens at all it just stays landscape.
I've tried numerous things, one of them looked promising : Fix for a screen rotation bug on ios10 but it didn't help in my case.
Another thing I've tried is this:
Screen.orientation = ScreenOrientation.Portrait;
Screen.autorotateToLandscapeLeft = false;
Screen.autorotateToLandscapeRight = false;
Screen.autorotateToPortrait = true;
Screen.autorotateToPortraitUpsideDown = true;
Screen.orientation = ScreenOrientation.AutoRotation;
to see if forcing the device to only have the option of landscape would make any difference and it does. It allows your game to go portrait if you turn the device but if you don't it'll stay landscape, it's not forcing the change as it should.
Has any of you ever encountered this behavior before? I don't know exactly what to do next.
For one, it could be that it's fixed in unity 2017.2, for two, you should check this link, there's a link on one of the answers referring to some kind of temporary fix:
Hi! thanks for the reply but if you open the link to the temporary solution on the bug you've linked it's the same that I've already tried (it's the link I have in my question about the things I've tried). It's true that the bugtracker says that It's fixed in all these versions :
but honestly being relatively near to a release I don't think that changing unity versions would be wise. Although if I don't find an answer I'll try to update to one of those versions and see what happens, but given that the "temporary workaround" doesn't work for me probably upgrading to those versions also won't work.2017.1.0b10, 5.6.2p1, 5.5.4p1, 5.4.5p4
Hi there, did you find fix for this? I noticed, that removing Screen.orientation = ScreenOrientation.AutoRotation; forces screen to rotate, but of course, blocks auto rotations.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Changing view based on device 0 Answers
Multiple Cars not working 1 Answer
How to open an internal file .vcf in C # to iPhone? 0 Answers
C# Script Not Working? (AdvancedAI) 0 Answers