- Home /
iOS: iPhone 4S doesn't change screen size for landscape
I've been logging Screen.width and Screen.height on different iOS devices, and the iPhone 4S seems to be the only one that doesn't update its reported values for a change in screen orientation.
I am setting the orientation to 'Landscape Left' from Unity and ensuring that setting is correct in Xcode. Once built, an iPad2 reports a screen.width of 1024 (due to being in landscape orientation) but an iPhone 4S still reports a width of 640 (the width of the device if in portrait orientation).
Is there a particular build setting that is causing an issue? The game does indeed display in landscape orientation, but the reported width and height are that of a portrait orientation.
EDIT: I decided to set the orientation to landscape left manually in my Start() function before checking the Screen size:
Screen.orientation = ScreenOrientation.LandscapeLeft;
Debug.Log ("set orientation manually: " + Screen.orientation);
Debug.Log ("Screen.width: " + Screen.width + " Screen height: " + Screen.height);
The orientation prints out as "Portrait" even though the game is in landscape view. I still also get a reported 640x960 screen size, instead of the expected 960x640 landscape screen.
Answer by cregox · Dec 14, 2012 at 02:14 PM
woooot, finally found out a solution!
Basically, use `Input.deviceOrientation` to force fixing the wrong `Screen` one! ;-)
Your answer
Follow this Question
Related Questions
Changing which axis the camera FOV/screen ratio is constrained by 0 Answers
iOS Screen Resolution bug when start in landscape 1 Answer
iOS GUIText size issue 1 Answer
When exporting from Unity to Xcode my game is extremely pixelised 0 Answers
Why is GameCenter UI leaving my orientation stuck the wrong way? How to fix it? 0 Answers