Search Unity

Splash screen default orientation problem

Discussion in 'Android' started by G0ldenbear, Apr 25, 2013.

  1. G0ldenbear

    G0ldenbear

    Joined:
    Sep 26, 2012
    Posts:
    5
    I've got a problem that I'm stumped on and I need some advise. I've scoured the forums and read the docs but can't find the solution. It is this;

    My iOS and Android app needs to run in left or right landscape modes only. In the PlayerSettings I've set Default orientation to Auto-Rotation and ticked Landscape Left and Landscape Right options only (ie. I've unticked Portrait and Portrait Upside Down).

    When I run on either iOS or Android devices the splash screen will only pick one of the 2 options and will not use the orientation-sensor to determine the correct orientation for the splash screen. Once the first scene has loaded and the game code starts running then the orientation corrects itself, but having an upside down splash screen is unacceptable for us.

    What's interesting is that if I select all 4 auto-rotation orientations then it picks the right one in the splash screen, so clearly it can honour the sensor on that screen, its only if I select 2 orientations that it doesnt work. It also doesnt work if I select just the 2 portrait modes either, again it only uses one of them.

    Right now this looks like a Unity bug to me, but I cant believe something so fundamental would still be in there, so I'm reaching out to the community in the hope it's just something I've messed up.

    Btw, I'm on Unity 4.1.0f4.
     
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    let me try to recheck what i got out of your question?
    When you select both landscape orients as allowed - splash is shown upside down on both android and ios? or android only?
     
  3. G0ldenbear

    G0ldenbear

    Joined:
    Sep 26, 2012
    Posts:
    5
    Alexey sorry it actually works fine on iOS, the problem is purely on Android only.
     
  4. woko

    woko

    Joined:
    Oct 11, 2011
    Posts:
    23
    I'm getting this behavior on both iOS and Android. I've selected Auto Rotation checked Landscape Right and Landscape Left, and the splash screen always appears in Landscape Left, even when the device is rotated to Landscape Right BEFORE starting the app. This certainly looks like a bug.
     
  5. woko

    woko

    Joined:
    Oct 11, 2011
    Posts:
    23
    I'm using the latest Unity (4.1.2f1) xcode (4.6.2).
     
  6. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Hi!

    This is most likely a problem due to devices < Gingerbread not supporting the 'sensorLandscape' manifest attribute. Since the manifest has to be compiled for the lowest targeted platform this means that if you set "Minimum API Level" to anything below Gingerbread, it effectively disables the reverse landscape and reverse portrait modes while showing the splash screen.

    Set "Minimum API Level" to Gingerbread and you should be fine - according to our stats it's a very low percentage that still runs Froyo or Eclair.
     
    CrandellWS likes this.
  7. G0ldenbear

    G0ldenbear

    Joined:
    Sep 26, 2012
    Posts:
    5
    Many thanks Bitter -- that was it! Set Minimum API Level to 'Android 2.3.1 Gingerbread (API Level 9)' and the landscape orientation is now correct.
     
  8. seandanger

    seandanger

    Joined:
    Jun 13, 2012
    Posts:
    39
    I wanted to solve this problem without having to change my minimum API level above 8 (Froyo). Here's how I did it:

    1. In Player Settings for Android, I changed Default Orientation to Landscape Left.

    2. In my main script file, which is always present and running in my Hierarchy, I added this to my Update() function.

    Code (csharp):
    1.  
    2. if (Input.deviceOrientation == DeviceOrientation.LandscapeRight)
    3. {
    4.     Screen.orientation = ScreenOrientation.LandscapeRight;
    5. }
    6. else if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft)
    7. {
    8.     Screen.orientation = ScreenOrientation.LandscapeLeft;
    9. }
    10.  
    This seems to work fine, the only drawback being that the splash screen will display upside down if the user is holding the device in Landscape Right orientation before launching the app. For me it's still better than being able to draw the splash screen in portrait mode.
     
  9. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    I have found this bug in my project and solved it successfully. There is no bug from unity side.

    I have checked my android manifest file and in that one of the manifest file contains wrong orientation.
    I have change it to correct one and everything works fine.
     
  10. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    ive got this same/similar problem. Im using unity pro 4.6.1f1 and Set "Minimum API Level" to Gingerbread 2.3.1 (level 9).

    I have just switched from IOS to android (everything was working perfect on IOS) but now when i build with landscape left and right selected in player settings and auto rotation on (or even just landscape left or right) the game starts in portrait mode and either crashes straight away or when i flip the phone over to landscape position it crashes.

    if i start the game holding the phone (galaxy s3) in landscape position the game will start and can be played. But if i then turn the phone over to portrait position the game crashes.

    Does anyone know how i can fix this please? Basically i just want the auto rotation - landscape left and right to work.

    Oh i should mention i build my games with playmaker so not the worlds greatest coder.

    Thanks.
     
    Last edited: Dec 30, 2014