- Home /
Screen.width and Screen.height sometimes flipped for Android
Is it just me or is Screen.width and Screen.height sometimes flipped for Android on 3.5.7 when on Landscape?
Answer by Bunny83 · Jan 16, 2013 at 12:51 PM
What do you mean by flipped?
I use a lot GUI stuff on Android and i use GUILayout in this rect:
GUILayout.BeginArea(new Rect(0,0,Screen.width, Screen.height));
It always represents the screen. So in Landscape mode Screen height is approximately the portrait's Screen.width. It doesn't exactly match since Android uses a soft-menu-bar (back / home button) which is subtracted from the actual height.
Okay, so in landscape mode, you have to use Screen.height when you actually mean Screen.width... it's annoying because this isn't so for iOS...
Uhmm, no, it's the same on iOS. When you rotate the screen the width / height changes.
It seems to change with each version of Unity.. Screen.width/height was not flipped in landscape in at least one previous version
Your answer
Follow this Question
Related Questions
Android screen orientation: why am I getting wrong screen size values? 1 Answer
Android orientation issue 1 Answer
Unity 3.5.7 Android Screen returns the wrong value? 0 Answers
Do screen.width and screen.height get updated depending on screen orientation on Android? 1 Answer
Screen height and width confusion 1 Answer