- Home /
rotated GUI behaving differently on iphone and ipad
Hello,
i am rotating my GUI via
if ((Input.deviceOrientation == DeviceOrientation.LandscapeLeft) && (Screen.orientation != ScreenOrientation.LandscapeLeft)) { Screen.orientation = ScreenOrientation.LandscapeLeft; }
if ((Input.deviceOrientation == DeviceOrientation.LandscapeRight)
&& (Screen.orientation != ScreenOrientation.LandscapeRight))
{
Screen.orientation = ScreenOrientation.LandscapeRight;
}
in the update of a component attached to a GameObject.
I've also set
iPhoneKeyboard.autorotateToPortrait = false;
iPhoneKeyboard.autorotateToPortraitUpsideDown = false;
iPhoneKeyboard.autorotateToLandscapeLeft = true;
iPhoneKeyboard.autorotateToLandscapeRight = true;
in the Start of that behaviour.
I also have other components that do have OnGUI-methods.
One in particular is behaving strange on the iphone (3g iOS 4.0/4g iOS 4.1) but NOT on the iPad (iOS 4.2.1 and another one with iOS 3.2). What happens is the following: The Visualisation of the GUI is rotated as expected but not the input, which means, that i do have do click on the old positions of the Buttons to click them.
Also the touches i get from Input.touches are still rotated "the old way" which means it is always you'd expect to get them when you'd never set the Screen.orientaion to anything.
What puzzles me is the following: It is behaving differently on different devices. There's nothing special about the broken component's OnGUI - i've reduced it to one button. The only thing i can say about it is, that it is the ingame-gui and that's the place where we're having the worst FPS (20-30). And why on earth is the visualisation rotated but the input is not?
All that makes be suspect, that either there is a Bug in Unity or the execution-order of the Update, OnGUI is somehow messed on the different platforms.
Did anyone observer similar behaviour? Is this a bug? How do i fix or work-around it?
best regards
-- Benjamin Schulz
If can make simple repro of one-two scripts, please report a bug. Thanks!
Answer by Benjamin Schulz · Apr 11, 2011 at 02:40 PM
Ok, found it: don't use Screen.SetResolution(1024, 768, Screen.fullScreen); on the ipad/iphone, that was what caused it.
Your answer
Follow this Question
Related Questions
How to drag a scrollView with TouchPhase.Moved? 0 Answers
iphone like date pickers 1 Answer
strange phenomenon after build and run 1 Answer
apple rejected app due to iphone & iPad resolution mismatch 1 Answer
How to identify each iOS device? 1 Answer