Can't get autorotation to work (iOS)

I would assume that going to the player settings in the editor and setting

  • Default orientation to autorotation.
  • Allowed orientations to include Landscape right and landscape left.
    should enable autorotation between the two landscape orientations. Isn’t this so? Well, for me it doesn’t seem to be working.

To try further I tried setting them in code:

Screen.orientation = ScreenOrientation.AutoRotation;
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;

But still no luck. I’m kind of confused as I was expecting this to work pretty much directly as the settings would suggest. Any ideas what’s wrong here? Xcode seems to show the correct possible orientations (although there isn’t a separate autorotation option available there). Xcode version is 5.1.1 and deployment target version 4.3.

… Ah, forget about this… :slight_smile: stupid failure on my side.

Can you tell me the stupid failure on your side, because I’d like to figure out what stupid thing I’m doing. :slight_smile:

My last build autorotated just fine – this one, not at all. I have the correct Player Settings chosen, and (like you) even went in and set things in code (which I hadn’t done in the build where rotation worked fine).

I’m about ready to ship this, but now it’s stuck on landscape left.

Jay

Hi! I don’t remember what it exactly was, but if I remember correctly I had a conditional check elsewhere in the code that disabled the rotation, and that conditional check gave the unwanted result probably due to having the script execution order a bit wrong. :slight_smile: