Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Can't get autorotation to work (iOS)

Discussion in 'iOS and tvOS' started by JeffersonTD, Dec 29, 2014.

  1. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    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.
     
  2. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    ... Ah, forget about this... :) stupid failure on my side.
     
    Last edited: Jan 6, 2015
  3. JayJennings

    JayJennings

    Joined:
    Jun 24, 2013
    Posts:
    184
    Can you tell me the stupid failure on your side, because I'd like to figure out what stupid thing I'm doing. :)

    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
     
  4. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    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. :)