x


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
more ▼

asked Mar 16 '11 at 04:14 PM

Benjamin Schulz gravatar image

Benjamin Schulz
2 2 2 4

If can make simple repro of one-two scripts, please report a bug. Thanks!

Apr 09 '11 at 08:41 PM Mantas Puida
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Ok, found it: don't use Screen.SetResolution(1024, 768, Screen.fullScreen); on the ipad/iphone, that was what caused it.

more ▼

answered Apr 11 '11 at 02:40 PM

Benjamin Schulz gravatar image

Benjamin Schulz
2 2 2 4

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3676
x2158
x1999
x1953
x360

asked: Mar 16 '11 at 04:14 PM

Seen: 1241 times

Last Updated: Mar 16 '11 at 04:22 PM